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
urlstringThe 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
urlstringThe URL for the request.
headersDictionary<string, string>Additional headers for the request.
Properties
Headers
Gets the headers for the request.
public Dictionary<string, string> Headers { get; }
Property Value
Identifier
Gets the identifier for the request.
public Guid Identifier { get; }
Property Value
Url
Gets or sets the URL for the request.
public string Url { get; set; }
Property Value
Methods
ExecuteAsync(Type, CancellationToken)
Executes the network request.
public abstract 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 abstract 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.