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
httpClientFactoryIHttpClientFactoryThe 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
urlstringThe URL for the request.
headersDictionary<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
urlstringThe URL for the request.
headersDictionary<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
urlstringThe URL for the request.
headersDictionary<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
urlstringThe URL for the request.
jsonDatastringThe JSON data to patch.
headersDictionary<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
urlstringThe URL for the request.
jsonDatastringThe JSON data to post.
headersDictionary<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
urlstringThe URL for the request.
headersDictionary<string, string>Optional additional headers for the request.
Returns
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
urlstringThe URL for the request.
jsonDatastringThe JSON data to put.
headersDictionary<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
clientNamestringThe name of the HttpClient to use.
Returns
- INetworkRequestFactory
A new INetworkRequestFactory configured with the named client.