Beispiel #1
0
 protected async Task <ApiResponse <T> > PostHttp <T>(string url, object data, bool requiresAuthentication = false)
 {
     return(await SendHttp <T>(() => new HttpRequestMessage(HttpMethod.Post, $"{BaseUri}/{url}")
     {
         Content = HttpClientHelpers.GetJsonBody(data)
     }, requiresAuthentication));
 }
Beispiel #2
0
 protected async Task <QuickResponse <T, TOptions> > PostHttp <T, TOptions>(string url, object data)
 {
     return(await SendHttp <T, TOptions>(() => new HttpRequestMessage(HttpMethod.Post, Options.BaseUri + url)
     {
         Content = HttpClientHelpers.GetJsonBody(data)
     }));
 }
Beispiel #3
0
        protected async Task <QuickResponse <T> > PostHttp <T>(string url, object data)
        {
            await SetInitialToken();

            var response = await _client.PostAsync(url, HttpClientHelpers.GetJsonBody(data));

            if (response.StatusCode == HttpStatusCode.Unauthorized)
            {
                await GetToken();

                response = await _client.PostAsync(url, HttpClientHelpers.GetJsonBody(data));
            }

            return(await QuickResponse <T> .FromMessage(response));
        }