public async Task DeleteAllImpostersAsync(CancellationToken cancellationToken = default)
 {
     using (var response = await _httpClient.DeleteAsync(ImpostersResource, cancellationToken).ConfigureAwait(false))
     {
         await HandleResponse(response, HttpStatusCode.OK, "Failed to delete the imposters.").ConfigureAwait(false);
     }
 }
        private void Delete(Job job)
        {
            _log.Debug($"[JobId={job.JobId}] [MessageText=Sending HTTP DELETE request to {job.CallbackUrl}.]");
            var request = _client.DeleteAsync(job.CallbackUrl).Result;

            request.EnsureSuccessStatusCode();
        }
Beispiel #3
0
        public TResponse DeleteJson <TResponse>(string queryString)
        {
            var url = BuildHttpClientUrl(
                GatewayHost,
                GatewayApiPath,
                GatewayPort,
                queryString);

            var response =
                Send <TResponse>(async() => await _client
                                 .DeleteAsync(url)
                                 .ConfigureAwait(false));

            return(response);
        }
Beispiel #4
0
        public async Task DeleteToDoItemAsync(string key)
        {
            try
            {
                var response = await _client.DeleteAsync(string.Format(Constants.ToDoApiUri, key));

                if (response.IsSuccessStatusCode)
                {
                    Debug.WriteLine("TodoItem successfully deleted.");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Error occurred calling ToDoApi: {ex.Message}");
            }
        }
        public async Task <bool> DeleteMarketingContactAsync(DeleteMarketingContactRequest request, CancellationToken cancellationToken)
        {
            string path        = $"api/DeleteMarketingContact";
            var    jsonContent = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");

            using (HttpResponseMessage response = await _httpClientWrapper.DeleteAsync(HttpClientConfigName.CommunicationService, path, jsonContent, cancellationToken).ConfigureAwait(false))
            {
                string jsonResponse = await response.Content.ReadAsStringAsync();

                var deleteMarketingContactResponse = JsonConvert.DeserializeObject <ResponseWrapper <bool, CommunicationServiceErrorCode> >(jsonResponse);
                if (deleteMarketingContactResponse.HasContent && deleteMarketingContactResponse.IsSuccessful)
                {
                    return(deleteMarketingContactResponse.Content);
                }
                return(false);
            }
        }
 private HttpResponseMessage ExecuteDelete(string resource) => _httpClient.DeleteAsync(resource).Result;
 private Task <HttpResponseMessage> ExecuteDeleteAsync(string resource) => _httpClient.DeleteAsync(resource);
Beispiel #8
0
        public Task DeleteBlog(int id)
        {
            var apiMethod = string.Format("Blog/Delete?id={0}", id);

            return(_httpClientWrapper.DeleteAsync <BlogDto>(apiMethod));
        }