Table of Contents

Class JsonPostNetworkRequest

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

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

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

Constructors

JsonPostNetworkRequest(HttpClient, string)

Initializes a new instance of the JsonPostNetworkRequest class.

public JsonPostNetworkRequest(HttpClient client, string url)

Parameters

client HttpClient

The HttpClient for executing the request.

url string

The URL for the request.

JsonPostNetworkRequest(HttpClient, string, string?)

Initializes a new instance of the JsonPostNetworkRequest class.

public JsonPostNetworkRequest(HttpClient client, string url, string? jsonData)

Parameters

client HttpClient

The HttpClient for executing the request.

url string

The URL for the request.

jsonData string

The JSON data to post.

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

Initializes a new instance of the JsonPostNetworkRequest class.

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

Parameters

client HttpClient

The HttpClient for executing the request.

url string

The URL for the request.

jsonData string

The JSON data to post.

headers Dictionary<string, string>

The additional headers.

Properties

Data

Gets or sets the data.

public string? Data { get; set; }

Property Value

string

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.