Created
May 22, 2021 00:21
-
-
Save MelbourneDeveloper/dbf49bbc85ba0241996e47244d89b823 to your computer and use it in GitHub Desktop.
IClient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Dependency Injection abstraction for Rest Clients. Use the CreateClient delegate to create an IClient when more than one is needed for an application. | |
/// </summary> | |
public interface IClient | |
{ | |
/// <summary> | |
/// Sends a strongly typed request to the server and waits for a strongly typed response | |
/// </summary> | |
/// <typeparam name="TResponseBody">The expected type of the response body</typeparam> | |
/// <param name="request">The request that will be translated to a HTTP request</param> | |
/// <returns>The response as the strong type specified by TResponseBody /></returns> | |
/// <typeparam name="TRequestBody"></typeparam> | |
Task<Response<TResponseBody>> SendAsync<TResponseBody, TRequestBody>(IRequest<TRequestBody> request); | |
/// <summary> | |
/// Default headers to be sent with HTTP requests | |
/// </summary> | |
IHeadersCollection DefaultRequestHeaders { get; } | |
/// <summary> | |
/// Base Url for the client. Any resources specified on requests will be relative to this. | |
/// </summary> | |
AbsoluteUrl BaseUrl { get; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment