Class ThirdwebHttpClient
- Namespace
- Thirdweb
- Assembly
- Thirdweb.dll
Represents a HTTP client for the Thirdweb SDK.
public class ThirdwebHttpClient : IThirdwebHttpClient, IDisposable
- Inheritance
-
ThirdwebHttpClient
- Implements
- Inherited Members
Constructors
ThirdwebHttpClient()
Initializes a new instance of the ThirdwebHttpClient class.
public ThirdwebHttpClient()
Properties
Headers
Gets the headers for the HTTP client.
public Dictionary<string, string> Headers { get; }
Property Value
Methods
AddHeader(string, string)
Adds a header to the HTTP client.
public void AddHeader(string key, string value)
Parameters
ClearHeaders()
Clears all headers from the HTTP client.
public void ClearHeaders()
DeleteAsync(string, CancellationToken)
Sends a DELETE request to the specified URI.
public Task<ThirdwebHttpResponseMessage> DeleteAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringThe request URI.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<ThirdwebHttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HTTP response message.
Dispose()
Disposes the HTTP client.
public void Dispose()
Dispose(bool)
Disposes the HTTP client.
protected virtual void Dispose(bool disposing)
Parameters
disposingboolWhether the client is being disposed.
GetAsync(string, CancellationToken)
Sends a GET request to the specified URI.
public Task<ThirdwebHttpResponseMessage> GetAsync(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringThe request URI.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<ThirdwebHttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HTTP response message.
PostAsync(string, HttpContent, CancellationToken)
Sends a POST request to the specified URI.
public Task<ThirdwebHttpResponseMessage> PostAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default)
Parameters
requestUristringThe request URI.
contentHttpContentThe HTTP content to send.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<ThirdwebHttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HTTP response message.
PutAsync(string, HttpContent, CancellationToken)
Sends a PUT request to the specified URI.
public Task<ThirdwebHttpResponseMessage> PutAsync(string requestUri, HttpContent content, CancellationToken cancellationToken = default)
Parameters
requestUristringThe request URI.
contentHttpContentThe HTTP content to send.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<ThirdwebHttpResponseMessage>
A task that represents the asynchronous operation. The task result contains the HTTP response message.
RemoveHeader(string)
Removes a header from the HTTP client.
public void RemoveHeader(string key)
Parameters
keystringThe header key.
SetHeaders(Dictionary<string, string>)
Sets the headers for the HTTP client.
public void SetHeaders(Dictionary<string, string> headers)
Parameters
headersDictionary<string, string>The headers to set.