Nakama .NET Client SDK 3.16.0
Nakama .NET Client SDK
Loading...
Searching...
No Matches
Nakama.HttpRequestAdapter Class Reference

HTTP Request adapter which uses the .NET HttpClient to send requests. More...

Inheritance diagram for Nakama.HttpRequestAdapter:
Nakama.IHttpAdapter

Public Member Functions

 HttpRequestAdapter (HttpClient httpClient)
 
async Task< string > SendAsync (string method, Uri uri, IDictionary< string, string > headers, byte[] body, int timeout, CancellationToken? userCancelToken)
 Send a HTTP request.
Parameters
methodHTTP method to use for this request.
uriThe fully qualified URI to use.
headersRequest headers to set.
bodyRequest content body to set.
timeoutSecRequest timeout.
userCancelTokenA user-generated token that can be used to cancel the request.
Returns
A task which resolves to the contents of the response.

 

Static Public Member Functions

static IHttpAdapter WithGzip (bool decompression=false, bool compression=false)
 A new HTTP adapter with configuration for gzip support in the underlying HTTP client.
 
static bool IsTransientException (Exception e)
 

Properties

ILogger Logger [get, set]
 The logger to use with the adapter.
 
TransientExceptionDelegate TransientExceptionDelegate [get]
 

Detailed Description

HTTP Request adapter which uses the .NET HttpClient to send requests.

Accept header is always set as 'application/json'.

Constructor & Destructor Documentation

◆ HttpRequestAdapter()

Nakama.HttpRequestAdapter.HttpRequestAdapter ( HttpClient httpClient)
inline

Member Function Documentation

◆ IsTransientException()

static bool Nakama.HttpRequestAdapter.IsTransientException ( Exception e)
inlinestatic

◆ SendAsync()

async Task< string > Nakama.HttpRequestAdapter.SendAsync ( string method,
Uri uri,
IDictionary< string, string > headers,
byte[] body,
int timeout,
CancellationToken? userCancelToken )
inline

Send a HTTP request.

Parameters
methodHTTP method to use for this request.
uriThe fully qualified URI to use.
headersRequest headers to set.
bodyRequest content body to set.
timeoutSecRequest timeout.
userCancelTokenA user-generated token that can be used to cancel the request.
Returns
A task which resolves to the contents of the response.

Implements Nakama.IHttpAdapter.

◆ WithGzip()

static IHttpAdapter Nakama.HttpRequestAdapter.WithGzip ( bool decompression = false,
bool compression = false )
inlinestatic

A new HTTP adapter with configuration for gzip support in the underlying HTTP client.

NOTE Decompression does not work with Mono AOT on Android.

Parameters
decompressionIf automatic decompression should be enabled with the HTTP adapter.
compressionIf automatic compression should be enabled with the HTTP adapter.
Returns
A new HTTP adapter.

Property Documentation

◆ Logger

ILogger Nakama.HttpRequestAdapter.Logger
getset

The logger to use with the adapter.

Implements Nakama.IHttpAdapter.

◆ TransientExceptionDelegate

TransientExceptionDelegate Nakama.HttpRequestAdapter.TransientExceptionDelegate
get

Implements Nakama.IHttpAdapter.


The documentation for this class was generated from the following file: