public static Task <IRestApiResult <TResult> > PostAsync <TContent, TResult>(this IRestApiClient apiClient, Priority priority, string path, int retryCount, Func <int, TimeSpan> sleepDurationProvider, TContent content = default(TContent), IHttpContentResolver contentResolver = null, CancellationToken cancellationToken = default(CancellationToken)) { return(PollyDecorator( () => apiClient.PostAsync <TContent, TResult>(priority, path, cancellationToken: cancellationToken), retryCount, sleepDurationProvider)); }
public async Task PostAsync_IsUsingHttpPost() { // arrange _messageHandler.OnSendAsync((request, cancellationToken) => Task.FromResult(new HttpResponseMessage(System.Net.HttpStatusCode.OK))); // act var result = await _restApiClient.PostAsync(ApiRequest.To("https://someurl.com")).ConfigureAwait(false); Assert.Equal(HttpMethod.Post, _messageHandler.LatestRequestMessage.Method); }
public async Task <IActionResult> PostAuthorise([FromBody] AuthorisationArgs args) { if (_RestApiClient == null) { throw new ArgumentNullException(nameof(_RestApiClient)); } var source = new CancellationTokenSource(); var token = source.Token; _Logger.WriteLabStart(); var result = await _RestApiClient.PostAsync(args, $"{EndPointNames.CaregiversPortalApi.LabConfirmation}", token); return(Ok()); }
public static Task <IRestApiResult <TResult> > PostAsync <TContent, TResult>(this IRestApiClient apiClient, Priority priority, string path, int retryCount, int sleepDuration, TContent content = default(TContent), IList <KeyValuePair <string, string> > headers = null, IHttpContentResolver httpContentResolver = null, IHttpResponseResolver httpResponseResolver = null, CancellationToken cancellationToken = default(CancellationToken)) { return(PollyDecorator( () => apiClient.PostAsync <TContent, TResult>(priority, path, content, headers, httpContentResolver, httpResponseResolver, cancellationToken), retryCount, sleepDuration)); }
public async Task <TResponse> Post <TResponse>(List <KeyValuePair <string, string> > RequestHeader, object body) where TResponse : new() => await httpClient.PostAsync <TResponse>(RequestHeader, body);
public Task CancelJob(CancelJobDto dto) { return(_restApiClient.PostAsync($"{_hostServerUrl}/api/job/cancel", dto)); }