Interface ICivitaiHttpClient
- Namespace
- CivitaiSharp.Core.Http
- Assembly
- CivitaiSharp.Core.dll
Abstraction for HTTP communication with Civitai APIs. Provides strongly-typed async methods for standard HTTP verbs with JSON serialization/deserialization and error response parsing. Results are wrapped in Result<T>.
public interface ICivitaiHttpClient
Methods
DeleteAsync<TResponse>(string, CancellationToken)
Performs an HTTP DELETE request and deserializes the response.
Task<Result<TResponse>> DeleteAsync<TResponse>(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative URI to request.
cancellationTokenCancellationTokenToken to cancel the asynchronous operation.
Returns
Type Parameters
TResponseThe type to deserialize the response body into.
GetAsync<TResponse>(string, CancellationToken)
Performs an HTTP GET request and deserializes the response.
Task<Result<TResponse>> GetAsync<TResponse>(string requestUri, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative URI to request.
cancellationTokenCancellationTokenToken to cancel the asynchronous operation.
Returns
Type Parameters
TResponseThe type to deserialize the response body into.
PostAsync<TResponse>(string, object?, CancellationToken)
Performs an HTTP POST request with a JSON body and deserializes the response.
Task<Result<TResponse>> PostAsync<TResponse>(string requestUri, object? content, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative URI to request.
contentobjectThe content to serialize as JSON in the request body. Can be null.
cancellationTokenCancellationTokenToken to cancel the asynchronous operation.
Returns
Type Parameters
TResponseThe type to deserialize the response body into.
PutAsync<TResponse>(string, object?, CancellationToken)
Performs an HTTP PUT request with a JSON body and deserializes the response.
Task<Result<TResponse>> PutAsync<TResponse>(string requestUri, object? content, CancellationToken cancellationToken = default)
Parameters
requestUristringThe relative URI to request.
contentobjectThe content to serialize as JSON in the request body. Can be null.
cancellationTokenCancellationTokenToken to cancel the asynchronous operation.
Returns
Type Parameters
TResponseThe type to deserialize the response body into.