# Interface IAnthropicApiClient

Namespace
  AnthropicClient

Assembly
  AnthropicClient.dll

Represents a client for interacting with the Anthropic API.

    public interface IAnthropicApiClient

## Methods

### CancelMessageBatchAsync(string, CancellationToken)

Cancels a message batch asynchronously.

    Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)

#### Parameters

`batchId` string

  The ID of the message batch to cancel.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<MessageBatchResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse.

### CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken)

Counts the tokens in a message asynchronously.

    Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request, CancellationToken cancellationToken = default)

#### Parameters

`request` CountMessageTokensRequest

  The count message tokens request.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<TokenCountResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse.

### CreateFileAsync(CreateFileRequest, CancellationToken)

Creates a file asynchronously using the Files API.

    Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default)

#### Parameters

`request` CreateFileRequest

  The file creation request.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<AnthropicFile>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFile.

### CreateMessageAsync(MessageRequest, CancellationToken)

Creates a message asynchronously.

    Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request, CancellationToken cancellationToken = default)

#### Parameters

`request` MessageRequest

  The message request to create.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<MessageResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>.

### CreateMessageAsync(StreamMessageRequest, CancellationToken)

Creates a message asynchronously and streams the response.

    IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request, CancellationToken cancellationToken = default)

#### Parameters

`request` StreamMessageRequest

  The message request to create.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

IAsyncEnumerable<AnthropicEvent>

  An asynchronous enumerable that yields the response event by event.

### CreateMessageBatchAsync(MessageBatchRequest, CancellationToken)

Creates a batch of messages asynchronously.

    Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request, CancellationToken cancellationToken = default)

#### Parameters

`request` MessageBatchRequest

  The message batch request to create.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<MessageBatchResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse.

### DeleteFileAsync(string, CancellationToken)

Deletes a file by its ID asynchronously.

    Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)

#### Parameters

`fileId` string

  The ID of the file to delete.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<AnthropicFileDeleteResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFileDeleteResponse.

### DeleteMessageBatchAsync(string, CancellationToken)

Deletes a message batch asynchronously.

    Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)

#### Parameters

`batchId` string

  The ID of the message batch to delete.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<MessageBatchDeleteResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchDeleteResponse.

### GetFileAsync(string, CancellationToken)

Gets a file's content by its ID asynchronously.

    Task<AnthropicResult<Stream>> GetFileAsync(string fileId, CancellationToken cancellationToken = default)

#### Parameters

`fileId` string

  The ID of the file to get the content for.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<Stream>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is a stream containing the file content.

### GetFileInfoAsync(string, CancellationToken)

Gets a file's metadata by its ID asynchronously.

    Task<AnthropicResult<AnthropicFile>> GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default)

#### Parameters

`fileId` string

  The ID of the file to get.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<AnthropicFile>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFile.

### GetMessageBatchAsync(string, CancellationToken)

Gets a message batch asynchronously.

    Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)

#### Parameters

`batchId` string

  The ID of the message batch to get.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<MessageBatchResponse>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse.

### GetMessageBatchResultsAsync(string, CancellationToken)

Gets the results of a message batch asynchronously.

    Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> GetMessageBatchResultsAsync(string batchId, CancellationToken cancellationToken = default)

#### Parameters

`batchId` string

  The ID of the message batch to get the results for.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is IAsyncEnumerable<T> where T is MessageBatchResultItem.

### GetModelAsync(string, CancellationToken)

Gets a model by its ID asynchronously.

    Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId, CancellationToken cancellationToken = default)

#### Parameters

`modelId` string

  The ID of the model to get.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<AnthropicModel>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicModel.

### ListAllFilesAsync(int, CancellationToken)

Lists all files asynchronously, returning every page of results.

    IAsyncEnumerable<AnthropicResult<Page<AnthropicFile>>> ListAllFilesAsync(int limit = 20, CancellationToken cancellationToken = default)

#### Parameters

`limit` int

  The maximum number of files to return in each page.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

IAsyncEnumerable<AnthropicResult<Page<AnthropicFile>>>

  An asynchronous enumerable that yields the response as an AnthropicResult<T> where T is Page<T> where T is AnthropicFile.

### ListAllMessageBatchesAsync(int, CancellationToken)

Lists all message batches asynchronously.

    IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>> ListAllMessageBatchesAsync(int limit = 20, CancellationToken cancellationToken = default)

#### Parameters

`limit` int

  The maximum number of message batches to return in each page.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>>

  An asynchronous enumerable that yields the response as an AnthropicResult<T> where T is Page<T> where T is MessageBatchResponse.

### ListAllModelsAsync(int, CancellationToken)

Lists all models asynchronously, returning every page of results.

    IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20, CancellationToken cancellationToken = default)

#### Parameters

`limit` int

  The maximum number of models to return in each page.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>>

  An asynchronous enumerable that yields the response as an AnthropicResult<T> where T is Page<T> where T is AnthropicModel.

### ListFilesAsync(PagingRequest?, CancellationToken)

Lists files asynchronously, returning a single page of results.

    Task<AnthropicResult<Page<AnthropicFile>>> ListFilesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)

#### Parameters

`request` PagingRequest

  The paging request to use for listing the files.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<Page<AnthropicFile>>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is Page<T> where T is AnthropicFile.

### ListMessageBatchesAsync(PagingRequest?, CancellationToken)

Lists the message batches asynchronously.

    Task<AnthropicResult<Page<MessageBatchResponse>>> ListMessageBatchesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)

#### Parameters

`request` PagingRequest

  The paging request to use for listing the message batches.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<Page<MessageBatchResponse>>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is Page<T> where T is MessageBatchResponse.

### ListModelsAsync(PagingRequest?, CancellationToken)

Lists models asynchronously, returning a single page of results.

    Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)

#### Parameters

`request` PagingRequest

  The paging request to use for listing the models.

`cancellationToken` CancellationToken

  A token to cancel the asynchronous operation.

#### Returns

Task<AnthropicResult<Page<AnthropicModel>>>

  A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is Page<T> where T is AnthropicModel.