Table of Contents

Class NetworkRequest

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

Defines the model for a network request.

public abstract class NetworkRequest : INetworkRequest
Inheritance
NetworkRequest
Implements
Derived
Inherited Members
Extension Methods

Constructors

NetworkRequest(string)

Initializes a new instance of the NetworkRequest class.

protected NetworkRequest(string url)

Parameters

url string

The URL for the request.

NetworkRequest(string, Dictionary<string, string>?)

Initializes a new instance of the NetworkRequest class.

protected NetworkRequest(string url, Dictionary<string, string>? headers)

Parameters

url string

The URL for the request.

headers Dictionary<string, string>

Additional headers for the request.

Properties

Headers

Gets the headers for the request.

public Dictionary<string, string> Headers { get; }

Property Value

Dictionary<string, string>

Identifier

Gets the identifier for the request.

public Guid Identifier { get; }

Property Value

Guid

Url

Gets or sets the URL for the request.

public string Url { get; set; }

Property Value

string

Methods

ExecuteAsync(Type, CancellationToken)

Executes the network request.

public abstract 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 abstract 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.