ToString() 공개 메소드

public ToString ( ) : string
리턴 string
예제 #1
0
        public DelDerivedResResult DeleteDerivedResources(DelDerivedResParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("derived_resources").
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                if (param.Value is IEnumerable <string> )
                {
                    foreach (var item in (IEnumerable)param.Value)
                    {
                        urlBuilder.QueryString.Add(String.Format("{0}[]", param.Key), item.ToString());
                    }
                }
                else
                {
                    urlBuilder.QueryString[param.Key] = param.Value.ToString();
                }
            }

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelDerivedResResult result = DelDerivedResResult.Parse(response);
                return(result);
            }
        }
예제 #2
0
        private string GetDownloadUrl(UrlBuilder builder, IDictionary <string, object> parameters)
        {
            m_api.FinalizeUploadParameters(parameters);

            builder.SetParameters(parameters);

            return(builder.ToString());
        }
예제 #3
0
        private string GetDownloadUrl(UrlBuilder builder, IDictionary <string, object> parameters)
        {
            m_api.FinalizeUploadParameters(parameters);

            foreach (var param in parameters)
            {
                builder.QueryString[param.Key] = param.Value.ToString();
            }

            return(builder.ToString());
        }
예제 #4
0
        /// <summary>
        /// Deletes the upload preset.
        /// </summary>
        /// <param name="name">Name of the upload preset.</param>
        /// <returns></returns>
        public DeleteUploadPresetResult DeleteUploadPreset(string name)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV
                .Add("upload_presets")
                .Add(name)
                .BuildUrl());

            using (HttpWebResponse response = m_api.Call(HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                return(DeleteUploadPresetResult.Parse(response));
            }
        }
예제 #5
0
        /// <summary>
        /// Creates the upload preset.
        /// Upload presets allow you to define the default behavior for your uploads, instead of receiving these as parameters during the upload request itself. Upload presets have precedence over client-side upload parameters.
        /// </summary>
        /// <param name="parameters">Parameters of the upload preset.</param>
        /// <returns></returns>
        public UploadPresetResult CreateUploadPreset(UploadPresetParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("upload_presets").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(HttpMethod.POST, urlBuilder.ToString(), null, null))
            {
                return(UploadPresetResult.Parse(response));
            }
        }
예제 #6
0
        /// <summary>
        /// Explode multipage document to single pages
        /// </summary>
        /// <param name="parameters">Parameters of explosion</param>
        /// <returns>Result of operation</returns>
        public ExplodeResult Explode(ExplodeParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("explode").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                ExplodeResult result = ExplodeResult.Parse(response);
                return(result);
            }
        }
예제 #7
0
        /// <summary>
        /// Allows multi transformation
        /// </summary>
        /// <param name="parameters">Parameters of operation</param>
        /// <returns>Result of operation</returns>
        public MultiResult Multi(MultiParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("multi").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                MultiResult result = MultiResult.Parse(response);
                return(result);
            }
        }
예제 #8
0
        /// <summary>
        /// Eagerly generate sprites
        /// </summary>
        /// <param name="parameters">Parameters for sprite generation</param>
        /// <returns>Result of sprite generation</returns>
        public SpriteResult MakeSprite(SpriteParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("sprite").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                SpriteResult result = SpriteResult.Parse(response);
                return(result);
            }
        }
예제 #9
0
        public DelDerivedResResult DeleteDerivedResources(DelDerivedResParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("derived_resources").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelDerivedResResult result = DelDerivedResResult.Parse(response);
                return(result);
            }
        }
예제 #10
0
        public ListTransformsResult ListTransformations(ListTransformsParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListTransformsResult result = ListTransformsResult.Parse(response);
                return(result);
            }
        }
예제 #11
0
        public TransformResult DeleteTransform(string transformName)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(transformName).
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                TransformResult result = TransformResult.Parse(response);
                return(result);
            }
        }
        private string PrepareUrlForDatasourceOperation(string fieldExternalId, List <string> entriesExternalIds, string actionName)
        {
            if (string.IsNullOrEmpty(fieldExternalId))
            {
                throw new ArgumentNullException(nameof(fieldExternalId));
            }

            var parameters = new DataSourceEntriesParams(entriesExternalIds);
            var urlBuilder = new UrlBuilder(
                m_api.ApiUrlMetadataFieldV.Add(fieldExternalId).Add(actionName).BuildUrl(),
                parameters.ToParamsDictionary());
            var url = urlBuilder.ToString();

            return(url);
        }
예제 #13
0
        public ListTagsResult ListTags(ListTagsParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("tags").
                Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType)).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListTagsResult result = ListTagsResult.Parse(response);
                return(result);
            }
        }
예제 #14
0
        public UpdateTransformResult UpdateTransform(UpdateTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Transformation).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.PUT, urlBuilder.ToString(), null, null))
            {
                UpdateTransformResult result = UpdateTransformResult.Parse(response);
                return(result);
            }
        }
예제 #15
0
        public GetResourceResult UpdateResource(UpdateParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType)).
                Add(parameters.Type).Add(parameters.PublicId).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.POST, urlBuilder.ToString(), null, null))
            {
                return(GetResourceResult.Parse(response));
            }
        }
예제 #16
0
        public TransformResult CreateTransform(CreateTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Name).
                BuildUrl());

            urlBuilder.QueryString["transformation"] = parameters.Transform.Generate();

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.POST, urlBuilder.ToString(), null, null))
            {
                TransformResult result = TransformResult.Parse(response);
                return result;
            }
        }
예제 #17
0
        public TransformResult CreateTransform(CreateTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Name).
                BuildUrl());

            urlBuilder.QueryString["transformation"] = parameters.Transform.Generate();

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.POST, urlBuilder.ToString(), null, null))
            {
                TransformResult result = TransformResult.Parse(response);
                return(result);
            }
        }
예제 #18
0
        /// <summary>
        /// Updates the upload preset.
        /// Every update overwrites all the preset settings.
        /// </summary>
        /// <param name="parameters">New parameters for upload preset.</param>
        /// <returns></returns>
        public UploadPresetResult UpdateUploadPreset(UploadPresetParams parameters)
        {
            var @params = parameters.ToParamsDictionary();

            @params.Remove("name");

            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV
                .Add("upload_presets")
                .Add(parameters.Name)
                .BuildUrl(),
                @params);

            using (HttpWebResponse response = m_api.Call(HttpMethod.PUT, urlBuilder.ToString(), null, null))
            {
                return(UploadPresetResult.Parse(response));
            }
        }
예제 #19
0
        public GetTransformResult GetTransform(GetTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Transformation).
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                urlBuilder.QueryString[param.Key] = param.Value.ToString();
            }

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                GetTransformResult result = GetTransformResult.Parse(response);
                return(result);
            }
        }
예제 #20
0
        public GetResourceResult GetResource(GetResourceParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType)).
                Add(parameters.Type).Add(parameters.PublicId).
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                urlBuilder.QueryString[param.Key] = param.Value.ToString();
            }

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                GetResourceResult result = GetResourceResult.Parse(response);
                return(result);
            }
        }
예제 #21
0
        public ListResourcesResult ListResources(ListResourcesParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType)).
                Add(!String.IsNullOrEmpty(parameters.Tag) ? String.Format("tags/{0}", parameters.Tag) : String.Empty).
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                urlBuilder.QueryString[param.Key] = param.Value.ToString();
            }

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListResourcesResult result = ListResourcesResult.Parse(response);
                return(result);
            }
        }
예제 #22
0
        /// <summary>
        /// Lists resources.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        public ListResourcesResult ListResources(ListResourcesParams parameters)
        {
            var url = m_api.ApiUrlV.
                      ResourceType("resources").
                      Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType));

            if (parameters is ListResourcesByTagParams)
            {
                var tagParams = (ListResourcesByTagParams)parameters;
                if (!String.IsNullOrEmpty(tagParams.Tag))
                {
                    url.Add("tags").Add(tagParams.Tag);
                }
            }

            if (parameters is ListResourcesByModerationParams)
            {
                var modParams = (ListResourcesByModerationParams)parameters;

                if (!String.IsNullOrEmpty(modParams.ModerationKind))
                {
                    url
                    .Add("moderations")
                    .Add(modParams.ModerationKind)
                    .Add(Api.GetCloudinaryParam <ModerationStatus>(modParams.ModerationStatus));
                }
            }

            UrlBuilder urlBuilder = new UrlBuilder(
                url.BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListResourcesResult result = ListResourcesResult.Parse(response);
                return(result);
            }
        }
예제 #23
0
        public DelResResult DeleteResources(DelResParams parameters)
        {
            Url url = m_api.ApiUrlV.
                      Add("resources").
                      Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType));

            if (String.IsNullOrEmpty(parameters.Tag))
            {
                url = url.Add(parameters.Type);
            }
            else
            {
                url = url.Add("tags").Add(parameters.Tag);
            }

            UrlBuilder urlBuilder = new UrlBuilder(url.BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                if (param.Value is IEnumerable <string> )
                {
                    foreach (var item in (IEnumerable)param.Value)
                    {
                        urlBuilder.QueryString.Add(String.Format("{0}[]", param.Key), item.ToString());
                    }
                }
                else
                {
                    urlBuilder.QueryString[param.Key] = param.Value.ToString();
                }
            }

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelResResult result = DelResResult.Parse(response);
                return(result);
            }
        }
예제 #24
0
        public DelResResult DeleteResources(DelResParams parameters)
        {
            Url url = m_api.ApiUrlV.
                      Add("resources").
                      Add(Api.GetCloudinaryParam <ResourceType>(parameters.ResourceType));

            if (String.IsNullOrEmpty(parameters.Tag))
            {
                url = url.Add(parameters.Type);
            }
            else
            {
                url = url.Add("tags").Add(parameters.Tag);
            }

            UrlBuilder urlBuilder = new UrlBuilder(url.BuildUrl(), parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                       HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelResResult result = DelResResult.Parse(response);
                return(result);
            }
        }
예제 #25
0
        public DelResResult DeleteResources(DelResParams parameters)
        {
            Url url = m_api.ApiUrlV.
                Add("resources").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType));

            if (String.IsNullOrEmpty(parameters.Tag))
            {
                url = url.Add(parameters.Type);
            }
            else
            {
                url = url.Add("tags").Add(parameters.Tag);
            }

            UrlBuilder urlBuilder = new UrlBuilder(url.BuildUrl(), parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelResResult result = DelResResult.Parse(response);
                return result;
            }
        }
예제 #26
0
        private string GetDownloadUrl(UrlBuilder builder, IDictionary<string, object> parameters)
        {
            m_api.FinalizeUploadParameters(parameters);

            builder.SetParameters(parameters);

            return builder.ToString();
        }
예제 #27
0
        /// <summary>
        /// Deletes the upload preset.
        /// </summary>
        /// <param name="name">Name of the upload preset.</param>
        /// <returns></returns>
        public DeleteUploadPresetResult DeleteUploadPreset(string name)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV
                .Add("upload_presets")
                .Add(name)
                .BuildUrl());

            using (HttpWebResponse response = m_api.Call(HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                return DeleteUploadPresetResult.Parse(response);
            }
        }
예제 #28
0
        public ListResourcesResult ListResources(ListResourcesParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).
                Add(!String.IsNullOrEmpty(parameters.Tag) ? String.Format("tags/{0}", parameters.Tag) : String.Empty).
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                urlBuilder.QueryString[param.Key] = param.Value.ToString();
            }

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListResourcesResult result = ListResourcesResult.Parse(response);
                return result;
            }
        }
예제 #29
0
        /// <summary>
        /// Allows multi transformation
        /// </summary>
        /// <param name="parameters">Parameters of operation</param>
        /// <returns>Result of operation</returns>
        public MultiResult Multi(MultiParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("multi").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                MultiResult result = MultiResult.Parse(response);
                return result;
            }
        }
예제 #30
0
        /// <summary>
        /// Updates the upload preset.
        /// Every update overwrites all the preset settings.
        /// </summary>
        /// <param name="parameters">New parameters for upload preset.</param>
        /// <returns></returns>
        public UploadPresetResult UpdateUploadPreset(UploadPresetParams parameters)
        {
            var @params = parameters.ToParamsDictionary();
            @params.Remove("name");

            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV
                .Add("upload_presets")
                .Add(parameters.Name)
                .BuildUrl(),
                @params);

            using (HttpWebResponse response = m_api.Call(HttpMethod.PUT, urlBuilder.ToString(), null, null))
            {
                return UploadPresetResult.Parse(response);
            }
        }
예제 #31
0
        /// <summary>
        /// Eagerly generate sprites
        /// </summary>
        /// <param name="parameters">Parameters for sprite generation</param>
        /// <returns>Result of sprite generation</returns>
        public SpriteResult MakeSprite(SpriteParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("sprite").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                SpriteResult result = SpriteResult.Parse(response);
                return result;
            }
        }
예제 #32
0
        public TransformResult DeleteTransform(string transformName)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(transformName).
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                TransformResult result = TransformResult.Parse(response);
                return result;
            }
        }
예제 #33
0
        /// <summary>
        /// Explode multipage document to single pages
        /// </summary>
        /// <param name="parameters">Parameters of explosion</param>
        /// <returns>Result of operation</returns>
        public ExplodeResult Explode(ExplodeParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlImgUpV.
                Action("explode").
                BuildUrl());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.POST, urlBuilder.ToString(), parameters.ToParamsDictionary(), null))
            {
                ExplodeResult result = ExplodeResult.Parse(response);
                return result;
            }
        }
예제 #34
0
        public DelDerivedResResult DeleteDerivedResources(DelDerivedResParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("derived_resources").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelDerivedResResult result = DelDerivedResResult.Parse(response);
                return result;
            }
        }
예제 #35
0
        public DelResResult DeleteResources(DelResParams parameters)
        {
            Url url = m_api.ApiUrlV.
                Add("resources").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType));

            if (String.IsNullOrEmpty(parameters.Tag))
            {
                url = url.Add(parameters.Type);
            }
            else
            {
                url = url.Add("tags").Add(parameters.Tag);
            }

            UrlBuilder urlBuilder = new UrlBuilder(url.BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                if (param.Value is IEnumerable<string>)
                {
                    foreach (var item in (IEnumerable)param.Value)
                    {
                        urlBuilder.QueryString.Add(String.Format("{0}[]", param.Key), item.ToString());
                    }
                }
                else
                {
                    urlBuilder.QueryString[param.Key] = param.Value.ToString();
                }
            }

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelResResult result = DelResResult.Parse(response);
                return result;
            }
        }
예제 #36
0
        public GetTransformResult GetTransform(GetTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Transformation).
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                urlBuilder.QueryString[param.Key] = param.Value.ToString();
            }

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                GetTransformResult result = GetTransformResult.Parse(response);
                return result;
            }
        }
예제 #37
0
        public ListTagsResult ListTags(ListTagsParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("tags").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListTagsResult result = ListTagsResult.Parse(response);
                return result;
            }
        }
예제 #38
0
        public UpdateTransformResult UpdateTransform(UpdateTransformParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                Add(parameters.Transformation).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.PUT, urlBuilder.ToString(), null, null))
            {
                UpdateTransformResult result = UpdateTransformResult.Parse(response);
                return result;
            }
        }
예제 #39
0
        public DelDerivedResResult DeleteDerivedResources(DelDerivedResParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("derived_resources").
                BuildUrl());

            foreach (var param in parameters.ToParamsDictionary())
            {
                if (param.Value is IEnumerable<string>)
                {
                    foreach (var item in (IEnumerable)param.Value)
                    {
                        urlBuilder.QueryString.Add(String.Format("{0}[]", param.Key), item.ToString());
                    }
                }
                else
                {
                    urlBuilder.QueryString[param.Key] = param.Value.ToString();
                }
            }

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.DELETE, urlBuilder.ToString(), null, null))
            {
                DelDerivedResResult result = DelDerivedResResult.Parse(response);
                return result;
            }
        }
예제 #40
0
        public ListTransformsResult ListTransformations(ListTransformsParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("transformations").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListTransformsResult result = ListTransformsResult.Parse(response);
                return result;
            }
        }
예제 #41
0
        public GetResourceResult GetResource(GetResourceParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).
                Add(parameters.Type).Add(parameters.PublicId).
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                GetResourceResult result = GetResourceResult.Parse(response);
                return result;
            }
        }
예제 #42
0
        /// <summary>
        /// Lists resources.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        public ListResourcesResult ListResources(ListResourcesParams parameters)
        {
            var url = m_api.ApiUrlV.
                ResourceType("resources").
                Add(Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType));

            if (parameters is ListResourcesByTagParams)
            {
                var tagParams = (ListResourcesByTagParams)parameters;
                if (!String.IsNullOrEmpty(tagParams.Tag))
                    url.Add("tags").Add(tagParams.Tag);
            }

            if (parameters is ListResourcesByModerationParams)
            {
                var modParams = (ListResourcesByModerationParams)parameters;

                if (!String.IsNullOrEmpty(modParams.ModerationKind))
                {
                    url
                        .Add("moderations")
                        .Add(modParams.ModerationKind)
                        .Add(Api.GetCloudinaryParam<ModerationStatus>(modParams.ModerationStatus));
                }
            }

            UrlBuilder urlBuilder = new UrlBuilder(
                url.BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(
                HttpMethod.GET, urlBuilder.ToString(), null, null))
            {
                ListResourcesResult result = ListResourcesResult.Parse(response);
                return result;
            }
        }
예제 #43
0
        /// <summary>
        /// Creates the upload preset.
        /// Upload presets allow you to define the default behavior for your uploads, instead of receiving these as parameters during the upload request itself. Upload presets have precedence over client-side upload parameters.
        /// </summary>
        /// <param name="parameters">Parameters of the upload preset.</param>
        /// <returns></returns>
        public UploadPresetResult CreateUploadPreset(UploadPresetParams parameters)
        {
            UrlBuilder urlBuilder = new UrlBuilder(
                m_api.ApiUrlV.
                Add("upload_presets").
                BuildUrl(),
                parameters.ToParamsDictionary());

            using (HttpWebResponse response = m_api.Call(HttpMethod.POST, urlBuilder.ToString(), null, null))
            {
                return UploadPresetResult.Parse(response);
            }
        }