Table of Contents

Class JsonGetNetworkRequest

Namespace
MADE.Networking.Http.Requests.Json
Assembly
MADE.Networking.dll

Defines a network request for a GET call with a JSON response.

public sealed class JsonGetNetworkRequest : NetworkRequest, INetworkRequest
Inheritance
JsonGetNetworkRequest
Implements
Inherited Members
Extension Methods

Constructors

JsonGetNetworkRequest(HttpClient, string)

Initializes a new instance of the JsonGetNetworkRequest class.

public JsonGetNetworkRequest(HttpClient client, string url)

Parameters

client HttpClient

The HttpClient for executing the request.

url string

The URL for the request.

JsonGetNetworkRequest(HttpClient, string, Dictionary<string, string>?)

Initializes a new instance of the JsonGetNetworkRequest class.

public JsonGetNetworkRequest(HttpClient client, string url, Dictionary<string, string>? headers)

Parameters

client HttpClient

The HttpClient for executing the request.

url string

The URL for the request.

headers Dictionary<string, string>

The additional headers.

Methods

ExecuteAsync(Type, CancellationToken)

Executes the network request.

public override Task<object> ExecuteAsync(Type expectedResponse, CancellationToken cancellationToken = default)

Parameters

expectedResponse Type

The type expected by the response of the request.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<object>

Returns the response of the request as an object.

ExecuteAsync<TResponse>(CancellationToken)

Executes the network request.

public override Task<TResponse> ExecuteAsync<TResponse>(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResponse>

Returns the response of the request as the specified type.

Type Parameters

TResponse

The type of object returned from the request.