Class RestClient
A REST client implementation.
Inherited Members
Namespace: Oci.Common.Http
Assembly: OCI.DotNetSDK.Common.dll
Syntax
public class RestClient
Constructors
RestClient()
Declaration
public RestClient()
RestClient(IBasicAuthenticationDetailsProvider, ClientConfiguration, RequestSigner)
Declaration
public RestClient(IBasicAuthenticationDetailsProvider authProvider, ClientConfiguration clientConfiguration, RequestSigner requestSigner)
Parameters
Type | Name | Description |
---|---|---|
IBasicAuthenticationDetailsProvider | authProvider | |
ClientConfiguration | clientConfiguration | |
RequestSigner | requestSigner |
RestClient(IBasicAuthenticationDetailsProvider, RequestSigner)
Declaration
public RestClient(IBasicAuthenticationDetailsProvider authProvider, RequestSigner requestSigner)
Parameters
Type | Name | Description |
---|---|---|
IBasicAuthenticationDetailsProvider | authProvider | |
RequestSigner | requestSigner |
RestClient(RestClientHandler)
Declaration
public RestClient(RestClientHandler handler)
Parameters
Type | Name | Description |
---|---|---|
RestClientHandler | handler |
RestClient(RestClientHandler, ClientConfiguration)
Declaration
public RestClient(RestClientHandler handler, ClientConfiguration clientConfiguration)
Parameters
Type | Name | Description |
---|---|---|
RestClientHandler | handler | |
ClientConfiguration | clientConfiguration |
Properties
RealmSpecificEndpointTemplate
Declaration
public string RealmSpecificEndpointTemplate { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
CheckHttpResponseMessage(HttpRequestMessage, HttpResponseMessage, ApiDetails)
Check if the HttpResponseMessage is a successful response.
Declaration
public void CheckHttpResponseMessage(HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, ApiDetails apiDetails = null)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | httpRequest | The HttpRequestMessage sent. |
HttpResponseMessage | httpResponse | |
ApiDetails | apiDetails |
Dispose()
Disposes the HTTP client
Declaration
public void Dispose()
GetEndpoint()
Retrieves the endpoint Uri.
Declaration
public Uri GetEndpoint()
Returns
Type | Description |
---|---|
Uri | The base address of the HTTP client. |
HttpSend(HttpRequestMessage, HttpCompletionOption, CancellationToken)
Sends HTTP request.
Declaration
public Task<HttpResponseMessage> HttpSend(HttpRequestMessage httpRequest, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | httpRequest | The HttpRequestMessage to be sent. |
HttpCompletionOption | completionOption | |
CancellationToken | cancellationToken | The CancellationToken to be used. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> | A Task of HttpResponseMessage returned. |
SetDefaultUserAgent(string)
Sets the default user agent in HTTP client.
Declaration
public void SetDefaultUserAgent(string userAgent)
Parameters
Type | Name | Description |
---|---|---|
string | userAgent | A user agent string. |
SetEndpoint(string)
Sets the base address for the HTTP client.
Declaration
public void SetEndpoint(string endpoint)
Parameters
Type | Name | Description |
---|---|---|
string | endpoint | The service endpoint. |