Table of Contents

Class NetworkRequestManager

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

Defines a manager for executing queued network requests.

public sealed class NetworkRequestManager : INetworkRequestManager, IDisposable
Inheritance
NetworkRequestManager
Implements
Inherited Members
Extension Methods

Constructors

NetworkRequestManager()

Initializes a new instance of the NetworkRequestManager class.

public NetworkRequestManager()

Properties

CurrentQueue

Gets the current queue of network requests.

public ConcurrentDictionary<string, NetworkRequestCallback> CurrentQueue { get; }

Property Value

ConcurrentDictionary<string, NetworkRequestCallback>

Methods

AddOrUpdate<TRequest, TResponse>(TRequest, Action<TResponse>)

Adds or updates a network request in the queue.

public void AddOrUpdate<TRequest, TResponse>(TRequest request, Action<TResponse> successCallback) where TRequest : NetworkRequest

Parameters

request TRequest

The network request to execute.

successCallback Action<TResponse>

The action to execute when receiving a successful response.

Type Parameters

TRequest

The type of network request.

TResponse

The expected response type.

Exceptions

Exception

The successCallback throws an exception acquiring method info.

OverflowException

The CurrentQueue already contains the maximum number of elements (MaxValue).

AddOrUpdate<TRequest, TResponse, TErrorResponse>(TRequest, Action<TResponse>, Action<TErrorResponse>?)

Adds or updates a network request in the queue.

public void AddOrUpdate<TRequest, TResponse, TErrorResponse>(TRequest request, Action<TResponse> successCallback, Action<TErrorResponse>? errorCallback) where TRequest : NetworkRequest

Parameters

request TRequest

The network request to execute.

successCallback Action<TResponse>

The action to execute when receiving a successful response.

errorCallback Action<TErrorResponse>

The action to execute when receiving an error response.

Type Parameters

TRequest

The type of network request.

TResponse

The expected response type.

TErrorResponse

The expected error response type.

Exceptions

Exception

The successCallback or errorCallback throws an exception acquiring method info.

OverflowException

The CurrentQueue already contains the maximum number of elements (MaxValue).

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

ProcessCurrentQueueAsync()

Processes the current queue of network requests.

public Task ProcessCurrentQueueAsync()

Returns

Task

An asynchronous operation.

Remove(INetworkRequest)

Removes a network request from the queue.

If the request is no longer in the queue, this method does nothing.

public void Remove(INetworkRequest request)

Parameters

request INetworkRequest

The request to remove from the queue.

RemoveByKey(string)

Removes a network request from the queue by the registered key identifier.

If the request is no longer in the queue, this method does nothing.

public void RemoveByKey(string key)

Parameters

key string

The key corresponding to the network request to remove from the queue.

Start()

Starts the manager processing the queue of network requests at a default time period of 1 minute.

public void Start()

Start(TimeSpan)

Starts the manager processing the queue of network requests.

public void Start(TimeSpan processPeriod)

Parameters

processPeriod TimeSpan

The time period between each process of the queue.

Stop()

Stops the processing of the network manager queues.

public void Stop()