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
clientHttpClientThe HttpClient for executing the request.
urlstringThe 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
clientHttpClientThe HttpClient for executing the request.
urlstringThe URL for the request.
jsonDatastringThe 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
clientHttpClientThe HttpClient for executing the request.
urlstringThe URL for the request.
jsonDatastringThe JSON data to post.
headersDictionary<string, string>The additional headers.
Properties
Data
Gets or sets the data.
public string? Data { get; set; }
Property Value
Methods
ExecuteAsync(Type, CancellationToken)
Executes the network request.
public override Task<object> ExecuteAsync(Type expectedResponse, CancellationToken cancellationToken = default)
Parameters
expectedResponseTypeThe type expected by the response of the request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
ExecuteAsync<TResponse>(CancellationToken)
Executes the network request.
public override Task<TResponse> ExecuteAsync<TResponse>(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<TResponse>
Returns the response of the request as the specified type.
Type Parameters
TResponseThe type of object returned from the request.