Table of Contents

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

Dictionary<string, string>

Methods

AddHeader(string, string)

Adds a header to the HTTP client.

public void AddHeader(string key, string value)

Parameters

key string

The header key.

value string

The header value.

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

requestUri string

The request URI.

cancellationToken CancellationToken

The 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

disposing bool

Whether 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

requestUri string

The request URI.

cancellationToken CancellationToken

The 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

requestUri string

The request URI.

content HttpContent

The HTTP content to send.

cancellationToken CancellationToken

The 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

requestUri string

The request URI.

content HttpContent

The HTTP content to send.

cancellationToken CancellationToken

The 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

key string

The header key.

SetHeaders(Dictionary<string, string>)

Sets the headers for the HTTP client.

public void SetHeaders(Dictionary<string, string> headers)

Parameters

headers Dictionary<string, string>

The headers to set.