Example #1
0
        public async Task <string> CreateDistribution(DistributionConfig request)
        {
            var requestUri = baseUrl + "/distribution";

            var body = @"<?xml version=""1.0"" encoding=""UTF-8""?>\n" + request.ToXml().ToString();

            var httpRequest = new HttpRequestMessage(HttpMethod.Post, requestUri)
            {
                Content = new StringContent(body, Encoding.UTF8, "text/xml")
            };

            return(await SendAsync(httpRequest).ConfigureAwait(false));
        }
Example #2
0
        public async Task <string> PutDistribution(string id, DistributionConfig request)
        {
            var requestUri = $"{baseUrl}/distribution/{id}/config";

            var httpRequest = new HttpRequestMessage(HttpMethod.Put, requestUri)
            {
                Content = new StringContent(
                    content: @"<?xml version=""1.0"" encoding=""UTF-8""?>\n" + request.ToXml().ToString(),
                    encoding: Encoding.UTF8,
                    mediaType: "text/xml"
                    )
            };

            return(await SendAsync(httpRequest).ConfigureAwait(false));
        }