Ejemplo n.º 1
0
        public async Task <UploadPresetResult> UpdateUploadPresetAsync(UploadPresetParams parameters)
        {
            var paramsDictionary = parameters.ToParamsDictionary();

            paramsDictionary.Remove("name");
            using (var response = await Api.CallAsync(HttpMethod.Put, Api.ApiUrlV.Add("upload_presets").Add(parameters.Name).BuildUrl(), paramsDictionary, null, null))
            {
                return(await UploadPresetResult.Parse(response));
            }
        }
Ejemplo n.º 2
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));
            }
        }
Ejemplo n.º 3
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));
            }
        }
Ejemplo n.º 4
0
 public async Task <UploadPresetResult> CreateUploadPresetAsync(UploadPresetParams parameters)
 {
     using (var response = await Api.CallAsync(HttpMethod.Post, Api.ApiUrlV.Add("upload_presets").BuildUrl(), parameters.ToParamsDictionary(), null, null))
     {
         return(await UploadPresetResult.Parse(response));
     }
 }