Show / Hide Table of Contents

Documentation common methods/properties

These are not all, just the most useful!

Creating an HttpClientService, or using the singleton

  • CreateHttpClientService() Creates or returns HttpClientService instances for the given logical name.

  • HttpClientServiceFactory.Instance A lazy singleton instantiation for use outside of a DI container (e.g. a Desktop app)

Setting IdentityServer options and Headers (HttpClientService)

  • SetIdentityServerOptions(TOptions) Sets the IdentityServer4 options by passing an object that inherits from Geko.HttpClientService.Models.ClientCredentialsOptions

  • SetIdentityServerOptions(Action) Sets the IdentityServer4 options for retrieving an access token using client credentials by using a delegate.

  • SetIdentityServerOptions(IOptions) Sets the IdentityServer4 options for retrieving an access token using client credentials.

  • HeadersAdd(String, String) Adds a header to the request.

The System.Net.HttpStatusCode of the response.

Extension methods for GET, POST, PUT and DELETE

  • GetAsync(HttpClientService, String) Sends a GET request to the specified requestUri and returns the response wrapped in a ResponseObject<TResponseBody> in an asynchronous operation.
  • PostAsync<TRequestBody, TResponseBody>(HttpClientService, String, TRequestBody) Sends a POST request to the specified requestUri using requestBody as the body of the request with TRequestBody as the type of the requestBody. Returns the response wrapped in a ResponseObject<TResponseBody>.
  • PutAsync<TRequestBody, TResponseBody>(HttpClientService, String, TRequestBody Sends a PUT request to the specified requestUri using requestBody as the body of the request with TRequestBody as the type of the requestBody. Returns the response wrapped in a ResponseObject<TResponseBody>.
  • DeleteAsync(HttpClientService, String) Sends a DELETE request to the specified requestUri and returns the response wrapped in a ResponseObject<TResponseBody> in an asynchronous operation.

Defining a typed request body with content-type

  • TypeContent TypeContent is following the implementation of StringContent. e.g. new TypeContent(your-complex-type, Encoding.UTF8, "application/json");

ResponseObject properties

  • BodyAsStream The body of the response as System.IO.Stream.
  • BodyAsString The body of the response as System.String.
  • BodyAsType The body of the response converted to TResponseBody.
  • Error A description of the error, if any.
  • HasError A boolean indicating if there is an error in the current request.
  • Headers The System.Net.Http.Headers.HttpResponseHeaders.
  • HttpRequestMessge The entire System.Net.Http.HttpRequestMessage object for debugging purposes.
  • HttpResponseMessge The entire System.Net.Http.HttpResponseMessage object.
  • StatusCode
  • Improve this Doc
Back to top Generated by DocFX