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); } }
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); } }
public async Task <DelResResult> DeleteResourcesAsync(DelResParams parameters) { var url = Api.ApiUrlV.Add("resources").Add(Api.GetCloudinaryParam(parameters.ResourceType)); using ( var response = await Api.CallAsync(HttpMethod.Delete, new UrlBuilder((string.IsNullOrEmpty(parameters.Tag) ? url.Add(parameters.Type) : url.Add("tags").Add(parameters.Tag)).BuildUrl(), parameters.ToParamsDictionary()).ToString(), null, null, null)) { return(await DelResResult.Parse(response)); } }