Table of Contents

Class NetworkRequestFactory

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

Defines a factory for creating NetworkRequest instances using a managed HttpClient from IHttpClientFactory.

public class NetworkRequestFactory : INetworkRequestFactory
Inheritance
NetworkRequestFactory
Implements
Inherited Members
Extension Methods

Constructors

NetworkRequestFactory(IHttpClientFactory)

Initializes a new instance of the NetworkRequestFactory class.

public NetworkRequestFactory(IHttpClientFactory httpClientFactory)

Parameters

httpClientFactory IHttpClientFactory

The IHttpClientFactory used to create HttpClient instances.

Methods

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

Creates a JsonDeleteNetworkRequest for the specified URL.

public JsonDeleteNetworkRequest Delete(string url, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

JsonDeleteNetworkRequest

A configured JsonDeleteNetworkRequest.

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

Creates a JsonGetNetworkRequest for the specified URL.

public JsonGetNetworkRequest Get(string url, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

JsonGetNetworkRequest

A configured JsonGetNetworkRequest.

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

Creates a StreamGetNetworkRequest for the specified URL.

public StreamGetNetworkRequest GetStream(string url, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

StreamGetNetworkRequest

A configured StreamGetNetworkRequest.

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

Creates a JsonPatchNetworkRequest for the specified URL.

public JsonPatchNetworkRequest Patch(string url, string? jsonData = null, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

jsonData string

The JSON data to patch.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

JsonPatchNetworkRequest

A configured JsonPatchNetworkRequest.

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

Creates a JsonPostNetworkRequest for the specified URL.

public JsonPostNetworkRequest Post(string url, string? jsonData = null, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

jsonData string

The JSON data to post.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

JsonPostNetworkRequest

A configured JsonPostNetworkRequest.

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

Creates a MultipartFormDataPostNetworkRequest for the specified URL.

public MultipartFormDataPostNetworkRequest PostMultipart(string url, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

MultipartFormDataPostNetworkRequest

A configured MultipartFormDataPostNetworkRequest.

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

Creates a JsonPutNetworkRequest for the specified URL.

public JsonPutNetworkRequest Put(string url, string? jsonData = null, Dictionary<string, string>? headers = null)

Parameters

url string

The URL for the request.

jsonData string

The JSON data to put.

headers Dictionary<string, string>

Optional additional headers for the request.

Returns

JsonPutNetworkRequest

A configured JsonPutNetworkRequest.

WithClient(string)

Creates a new INetworkRequestFactory that uses the specified named HttpClient.

public INetworkRequestFactory WithClient(string clientName)

Parameters

clientName string

The name of the HttpClient to use.

Returns

INetworkRequestFactory

A new INetworkRequestFactory configured with the named client.