23 Commits
Author SHA1 Message Date
Stevan Freeborn d87f5cf7ef docs: documentation for v1.1.0 [skip ci] 2025-07-15 04:30:56 +00:00
Stevan Freeborn 071c9c133b chore(release): 1.1.0 [skip ci] 2025-07-15 04:30:23 +00:00
Stevan Freeborn b859859548 feat: add missing model constants 2025-07-14 23:30:02 -05:00
Stevan Freeborn 21ce029f09 chore: run dotnet format 2025-07-14 23:30:02 -05:00
Stevan Freeborn 723476b18f tests: add test for file source constructor with id 2025-07-14 23:30:02 -05:00
Stevan Freeborn 1f83899eb8 feat: add support for file source and url source 2025-07-14 23:30:02 -05:00
Stevan Freeborn 267972ca94 tests: remove unnecessary reason string 2025-07-14 23:30:02 -05:00
Stevan Freeborn 7657e661d0 docs: update files api section with examples for each method 2025-07-14 23:30:02 -05:00
Stevan Freeborn b48baffb60 fix: use sync copy to method 2025-07-14 23:30:02 -05:00
Stevan Freeborn ad3b990138 chore: run dotnet format 2025-07-14 23:30:02 -05:00
Stevan Freeborn ea4c8230bc refactor: remove unnecessary if checks and add test to handle getting null file 2025-07-14 23:30:02 -05:00
Stevan Freeborn 0aaf6e0995 tests: add tests for sad path in new files methods 2025-07-14 23:30:02 -05:00
Stevan Freeborn d1e88a52ac feat: implement GetFileInfoAsync, GetFileAsync, and DeleteFileAsync 2025-07-14 23:30:02 -05:00
Stevan Freeborn 9cb8443f94 feat: implement list all files method 2025-07-14 23:30:02 -05:00
Stevan Freeborn 9d5c620167 feat: implement listing a page of files 2025-07-14 23:30:02 -05:00
Stevan Freeborn c212ebffcd tests: add tests for anthropic file model 2025-07-14 23:30:02 -05:00
Stevan Freeborn 35c4147379 docs: add note about files beta status 2025-07-14 23:30:02 -05:00
Stevan Freeborn e52540eec3 tests: add end to end test 2025-07-14 23:30:02 -05:00
Stevan Freeborn b26e663960 tests: add integration test for creating file 2025-07-14 23:30:02 -05:00
Stevan Freeborn f4ffcf5fbc docs: fix xml comments 2025-07-14 23:30:02 -05:00
Stevan Freeborn 914495ab97 tests: add create file request tests 2025-07-14 23:30:02 -05:00
Stevan Freeborn 1cad19d9c6 fix: remove unnecessary usings 2025-07-14 23:30:02 -05:00
Stevan Freeborn e674b9afe6 feat: initial implementation of creating a file via the Files API 2025-07-14 23:30:02 -05:00
47 changed files with 5100 additions and 64 deletions
+144
View File
@@ -201,6 +201,150 @@ if (response.IsFailure)
Console.WriteLine("Model Id: {0}", response.Value.Id);
```
### Files API
The `AnthropicApiClient` provides support for the Anthropic Files API, which allows you to upload and manage files for use with the Anthropic API.
> [!NOTE]
> The Files API is currently in beta. To use the Files API, youll need to include the beta feature header: `anthropic-beta: files-api-2025-04-14`
#### Create a File
You can create a file using the Files API in several ways:
##### From a Byte Array
```csharp
var fileBytes = await File.ReadAllBytesAsync("path/to/file.txt");
var request = new CreateFileRequest(fileBytes, "file.txt", "text/plain");
var result = await client.CreateFileAsync(request);
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($"Created file: {file.Name} (ID: {file.Id})");
}
```
##### From a Stream
```csharp
using var fileStream = File.OpenRead("path/to/file.txt");
var request = new CreateFileRequest(fileStream, "file.txt", "text/plain");
var result = await client.CreateFileAsync(request);
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($"Created file: {file.Name} (ID: {file.Id})");
}
```
#### List Files
You can list files in your account using pagination:
##### Single Page
```csharp
var result = await client.ListFilesAsync();
if (result.IsSuccess)
{
var page = result.Value;
Console.WriteLine($"Found {page.Data.Count} files");
foreach (var file in page.Data)
{
Console.WriteLine($"- {file.Name} (ID: {file.Id}, Size: {file.Size} bytes)");
}
if (page.HasMore)
{
Console.WriteLine("More files available...");
}
}
```
##### With Pagination Options
```csharp
var pagingRequest = new PagingRequest(afterId: "file_12345", limit: 10);
var result = await client.ListFilesAsync(pagingRequest);
```
##### All Files (Multiple Pages)
```csharp
await foreach (var pageResult in client.ListAllFilesAsync(limit: 20))
{
if (pageResult.IsSuccess)
{
var page = pageResult.Value;
foreach (var file in page.Data)
{
Console.WriteLine($"- {file.Name} (ID: {file.Id})");
}
}
}
```
#### Get File Information
Retrieve metadata about a specific file:
```csharp
var result = await client.GetFileInfoAsync("file_12345");
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($"File: {file.Name}");
Console.WriteLine($"ID: {file.Id}");
Console.WriteLine($"MIME Type: {file.MimeType}");
Console.WriteLine($"Size: {file.Size} bytes");
Console.WriteLine($"Created: {file.CreatedAt}");
Console.WriteLine($"Downloadable: {file.Downloadable}");
}
```
#### Get File Content
Download the content of a file as a stream:
```csharp
var result = await client.GetFileAsync("file_12345");
if (result.IsSuccess)
{
using var contentStream = result.Value;
using var reader = new StreamReader(contentStream);
var content = await reader.ReadToEndAsync();
Console.WriteLine("File content:");
Console.WriteLine(content);
}
```
#### Delete a File
Remove a file from your account:
```csharp
var result = await client.DeleteFileAsync("file_12345");
if (result.IsSuccess)
{
var deleteResponse = result.Value;
Console.WriteLine($"Deleted file: {deleteResponse.Id}");
Console.WriteLine($"Type: {deleteResponse.Type}");
}
```
> [!NOTE]
> The Files API has certain limitations on file size, supported file types, and usage quotas. Please refer to the [Anthropic API Documentation](https://docs.anthropic.com/en/docs/build-with-claude/files) for the most up-to-date information on these limitations.
### Create a message
The `AnthropicApiClient` exposes a method named `CreateMessageAsync` that can be used to create a message. The method requires a `MessageRequest` or a `StreamMessageRequest` instance as a parameter. The `MessageRequest` class is used to create a message whose response is not streamed and the `StreamMessageRequest` class is used to create a message whose response is streamed. The `MessageRequest` instance's properties can be set to configure how the message is created.
+266 -14
View File
@@ -163,7 +163,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient__ctor_System_String_System_Net_Http_HttpClient_" data-uid="AnthropicClient.AnthropicApiClient.#ctor(System.String,System.Net.Http.HttpClient)">
AnthropicApiClient(string, HttpClient)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L37"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L38"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.AnthropicApiClient.html">AnthropicApiClient</a> class.</p>
@@ -209,7 +209,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_CancelMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CancelMessageBatchAsync(System.String,System.Threading.CancellationToken)">
CancelMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L303"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L304"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Cancels a message batch asynchronously.</p>
@@ -251,7 +251,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest,System.Threading.CancellationToken)">
CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L351"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L352"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Counts the tokens in a message asynchronously.</p>
@@ -289,11 +289,53 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_AnthropicApiClient_CreateFileAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateFileAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CreateFileAsync_AnthropicClient_Models_CreateFileRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)">
CreateFileAsync(CreateFileRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L385"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a file asynchronously using the Files API.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;AnthropicFile&gt;&gt; CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.CreateFileRequest.html">CreateFileRequest</a></dt>
<dd><p>The file creation request.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest,System.Threading.CancellationToken)">
CreateMessageAsync(MessageRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L56"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L57"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
@@ -335,7 +377,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest,System.Threading.CancellationToken)">
CreateMessageAsync(StreamMessageRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L79"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L80"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
@@ -377,7 +419,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageBatchAsync_AnthropicClient_Models_MessageBatchRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageBatchAsync(AnthropicClient.Models.MessageBatchRequest,System.Threading.CancellationToken)">
CreateMessageBatchAsync(MessageBatchRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L271"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L272"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a batch of messages asynchronously.</p>
@@ -415,11 +457,53 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_AnthropicApiClient_DeleteFileAsync_" data-uid="AnthropicClient.AnthropicApiClient.DeleteFileAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_DeleteFileAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)">
DeleteFileAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L435"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Deletes a file by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;AnthropicFileDeleteResponse&gt;&gt; DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to delete.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_DeleteMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_DeleteMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync(System.String,System.Threading.CancellationToken)">
DeleteMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L311"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L312"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Deletes a message batch asynchronously.</p>
@@ -457,11 +541,95 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_AnthropicApiClient_GetFileAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetFileAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetFileAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)">
GetFileAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L418"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a file's content by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;Stream&gt;&gt; GetFileAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to get the content for.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is a stream containing the file content.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_GetFileInfoAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetFileInfoAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetFileInfoAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)">
GetFileInfoAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L410"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a file's metadata by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;AnthropicFile&gt;&gt; GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to get.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_GetMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchAsync(System.String,System.Threading.CancellationToken)">
GetMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L278"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L279"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a message batch asynchronously.</p>
@@ -503,7 +671,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_GetMessageBatchResultsAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchResultsAsync(System.String,System.Threading.CancellationToken)">
GetMessageBatchResultsAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L319"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L320"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the results of a message batch asynchronously.</p>
@@ -545,7 +713,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_GetModelAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetModelAsync(System.String,System.Threading.CancellationToken)">
GetModelAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L376"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L377"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a model by its ID asynchronously.</p>
@@ -583,11 +751,53 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_AnthropicApiClient_ListAllFilesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListAllFilesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListAllFilesAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)">
ListAllFilesAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L401"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all files asynchronously, returning every page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IAsyncEnumerable&lt;AnthropicResult&lt;Page&lt;AnthropicFile&gt;&gt;&gt; ListAllFilesAsync(int limit = 20, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>limit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The maximum number of files to return in each page.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;&gt;</dt>
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListAllMessageBatchesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListAllMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListAllMessageBatchesAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListAllMessageBatchesAsync(System.Int32,System.Threading.CancellationToken)">
ListAllMessageBatchesAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L294"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L295"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all message batches asynchronously.</p>
@@ -629,7 +839,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_ListAllModelsAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListAllModelsAsync(System.Int32,System.Threading.CancellationToken)">
ListAllModelsAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L367"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L368"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all models asynchronously, returning every page of results.</p>
@@ -667,11 +877,53 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<a id="AnthropicClient_AnthropicApiClient_ListFilesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListFilesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListFilesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListFilesAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L392"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists files asynchronously, returning a single page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;Page&lt;AnthropicFile&gt;&gt;&gt; ListFilesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a></dt>
<dd><p>The paging request to use for listing the files.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListMessageBatchesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListMessageBatchesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListMessageBatchesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListMessageBatchesAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L285"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L286"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists the message batches asynchronously.</p>
@@ -713,7 +965,7 @@ Class AnthropicApiClient <a class="header-action link-secondary" title="View so
<h3 id="AnthropicClient_AnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListModelsAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L358"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L359"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists models asynchronously, returning a single page of results.</p>
@@ -205,6 +205,48 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
<a id="AnthropicClient_IAnthropicApiClient_CreateFileAsync_" data-uid="AnthropicClient.IAnthropicApiClient.CreateFileAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_CreateFileAsync_AnthropicClient_Models_CreateFileRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)">
CreateFileAsync(CreateFileRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L121"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a file asynchronously using the Files API.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">Task&lt;AnthropicResult&lt;AnthropicFile&gt;&gt; CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.CreateFileRequest.html">CreateFileRequest</a></dt>
<dd><p>The file creation request.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest,System.Threading.CancellationToken)">
@@ -331,6 +373,48 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
<a id="AnthropicClient_IAnthropicApiClient_DeleteFileAsync_" data-uid="AnthropicClient.IAnthropicApiClient.DeleteFileAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_DeleteFileAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)">
DeleteFileAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L162"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Deletes a file by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">Task&lt;AnthropicResult&lt;AnthropicFileDeleteResponse&gt;&gt; DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to delete.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_DeleteMessageBatchAsync_" data-uid="AnthropicClient.IAnthropicApiClient.DeleteMessageBatchAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_DeleteMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.DeleteMessageBatchAsync(System.String,System.Threading.CancellationToken)">
@@ -373,6 +457,90 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
<a id="AnthropicClient_IAnthropicApiClient_GetFileAsync_" data-uid="AnthropicClient.IAnthropicApiClient.GetFileAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_GetFileAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)">
GetFileAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L153"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a file's content by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">Task&lt;AnthropicResult&lt;Stream&gt;&gt; GetFileAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to get the content for.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is a stream containing the file content.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_GetFileInfoAsync_" data-uid="AnthropicClient.IAnthropicApiClient.GetFileInfoAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_GetFileInfoAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)">
GetFileInfoAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L145"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a file's metadata by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">Task&lt;AnthropicResult&lt;AnthropicFile&gt;&gt; GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>fileId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the file to get.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_GetMessageBatchAsync_" data-uid="AnthropicClient.IAnthropicApiClient.GetMessageBatchAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_GetMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.GetMessageBatchAsync(System.String,System.Threading.CancellationToken)">
@@ -499,6 +667,48 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
<a id="AnthropicClient_IAnthropicApiClient_ListAllFilesAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllFilesAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_ListAllFilesAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)">
ListAllFilesAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L137"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all files asynchronously, returning every page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">IAsyncEnumerable&lt;AnthropicResult&lt;Page&lt;AnthropicFile&gt;&gt;&gt; ListAllFilesAsync(int limit = 20, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>limit</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The maximum number of files to return in each page.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;&gt;</dt>
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_ListAllMessageBatchesAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_ListAllMessageBatchesAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.ListAllMessageBatchesAsync(System.Int32,System.Threading.CancellationToken)">
@@ -583,6 +793,48 @@ Interface IAnthropicApiClient <a class="header-action link-secondary" title="Vi
<a id="AnthropicClient_IAnthropicApiClient_ListFilesAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListFilesAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_ListFilesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListFilesAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/IAnthropicApiClient.cs/#L129"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists files asynchronously, returning a single page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">Task&lt;AnthropicResult&lt;Page&lt;AnthropicFile&gt;&gt;&gt; ListFilesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>request</code> <a class="xref" href="AnthropicClient.Models.PagingRequest.html">PagingRequest</a></dt>
<dd><p>The paging request to use for listing the files.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>&gt;&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_IAnthropicApiClient_ListMessageBatchesAsync_" data-uid="AnthropicClient.IAnthropicApiClient.ListMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_IAnthropicApiClient_ListMessageBatchesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.IAnthropicApiClient.ListMessageBatchesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
@@ -0,0 +1,412 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class AnthropicFile | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class AnthropicFile | AnthropicClient ">
<meta name="description" content="Represents a file object from the Anthropic Files API.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_AnthropicFile.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.AnthropicFile%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.AnthropicFile">
<h1 id="AnthropicClient_Models_AnthropicFile" data-uid="AnthropicClient.Models.AnthropicFile" class="text-break">
Class AnthropicFile <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L8"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a file object from the Anthropic Files API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class AnthropicFile</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">AnthropicFile</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_AnthropicFile_CreatedAt_" data-uid="AnthropicClient.Models.AnthropicFile.CreatedAt*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_CreatedAt" data-uid="AnthropicClient.Models.AnthropicFile.CreatedAt">
CreatedAt
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L31"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Date file was created.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;created_at&quot;)]
public DateTimeOffset CreatedAt { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.datetimeoffset">DateTimeOffset</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_Downloadable_" data-uid="AnthropicClient.Models.AnthropicFile.Downloadable*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_Downloadable" data-uid="AnthropicClient.Models.AnthropicFile.Downloadable">
Downloadable
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L49"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Whether the file can be downloaded.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;downloadable&quot;)]
public bool Downloadable { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_Id_" data-uid="AnthropicClient.Models.AnthropicFile.Id*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_Id" data-uid="AnthropicClient.Models.AnthropicFile.Id">
Id
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L13"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Unique object identifier.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;id&quot;)]
public string Id { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_MimeType_" data-uid="AnthropicClient.Models.AnthropicFile.MimeType*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_MimeType" data-uid="AnthropicClient.Models.AnthropicFile.MimeType">
MimeType
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L43"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>MIME type of the file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;mime_type&quot;)]
public string MimeType { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_Name_" data-uid="AnthropicClient.Models.AnthropicFile.Name*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_Name" data-uid="AnthropicClient.Models.AnthropicFile.Name">
Name
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L25"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Original filename of the uploaded file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;filename&quot;)]
public string Name { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_Size_" data-uid="AnthropicClient.Models.AnthropicFile.Size*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_Size" data-uid="AnthropicClient.Models.AnthropicFile.Size">
Size
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L37"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Size of the file in bytes.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;size_bytes&quot;)]
public long Size { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int64">long</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFile_Type_" data-uid="AnthropicClient.Models.AnthropicFile.Type*"></a>
<h3 id="AnthropicClient_Models_AnthropicFile_Type" data-uid="AnthropicClient.Models.AnthropicFile.Type">
Type
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L19"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Object type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;type&quot;)]
public string Type { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFile.cs/#L8" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
@@ -0,0 +1,245 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class AnthropicFileDeleteResponse | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class AnthropicFileDeleteResponse | AnthropicClient ">
<meta name="description" content="Represents the response from deleting a file in the Anthropic API.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_AnthropicFileDeleteResponse.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.AnthropicFileDeleteResponse%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse">
<h1 id="AnthropicClient_Models_AnthropicFileDeleteResponse" data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse" class="text-break">
Class AnthropicFileDeleteResponse <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFileDeleteResponse.cs/#L6"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents the response from deleting a file in the Anthropic API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class AnthropicFileDeleteResponse</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">AnthropicFileDeleteResponse</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_AnthropicFileDeleteResponse_Id_" data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse.Id*"></a>
<h3 id="AnthropicClient_Models_AnthropicFileDeleteResponse_Id" data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse.Id">
Id
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFileDeleteResponse.cs/#L11"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets or sets the ID of the file that was deleted.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string Id { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_AnthropicFileDeleteResponse_Type_" data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse.Type*"></a>
<h3 id="AnthropicClient_Models_AnthropicFileDeleteResponse_Type" data-uid="AnthropicClient.Models.AnthropicFileDeleteResponse.Type">
Type
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFileDeleteResponse.cs/#L16"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets or sets the response type</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string Type { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicFileDeleteResponse.cs/#L6" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
@@ -156,7 +156,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Haiku20241022" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Haiku20241022">
Claude35Haiku20241022
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L66"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L96"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Haiku model.</p>
@@ -187,7 +187,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35HaikuLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude35HaikuLatest">
Claude35HaikuLatest
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L71"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L101"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Haiku model.</p>
@@ -218,7 +218,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet">
Claude35Sonnet
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L36"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L46"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
@@ -249,7 +249,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet20240620" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet20240620">
Claude35Sonnet20240620
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L41"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L51"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
@@ -280,7 +280,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35Sonnet20241022" data-uid="AnthropicClient.Models.AnthropicModels.Claude35Sonnet20241022">
Claude35Sonnet20241022
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L46"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L56"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
@@ -311,7 +311,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude35SonnetLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest">
Claude35SonnetLatest
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L51"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L61"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
@@ -340,9 +340,71 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude37Sonnet20250219" data-uid="AnthropicClient.Models.AnthropicModels.Claude37Sonnet20250219">
Claude37Sonnet20250219
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L66"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string Claude37Sonnet20250219 = &quot;claude-3-7-sonnet-20250219&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_AnthropicModels_Claude37SonnetLatest" data-uid="AnthropicClient.Models.AnthropicModels.Claude37SonnetLatest">
Claude37SonnetLatest
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L71"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string Claude37SonnetLatest = &quot;claude-3-7-sonnet-latest&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Haiku" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Haiku">
Claude3Haiku
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L56"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L86"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Haiku model.</p>
@@ -373,7 +435,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Haiku20240307" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Haiku20240307">
Claude3Haiku20240307
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L61"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L91"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Haiku model.</p>
@@ -497,7 +559,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Sonnet" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Sonnet">
Claude3Sonnet
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L26"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L36"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
@@ -528,7 +590,7 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_Claude3Sonnet20240229" data-uid="AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229">
Claude3Sonnet20240229
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L31"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L41"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
@@ -557,6 +619,130 @@ Class AnthropicModels <a class="header-action link-secondary" title="View sourc
<h3 id="AnthropicClient_Models_AnthropicModels_ClaudeOpus40" data-uid="AnthropicClient.Models.AnthropicModels.ClaudeOpus40">
ClaudeOpus40
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L31"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 4 Opus model.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string ClaudeOpus40 = &quot;claude-opus-4-0&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_AnthropicModels_ClaudeOpus420250514" data-uid="AnthropicClient.Models.AnthropicModels.ClaudeOpus420250514">
ClaudeOpus420250514
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L26"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 4 Opus model.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string ClaudeOpus420250514 = &quot;claude-opus-4-20250514&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_AnthropicModels_ClaudeSonnet40" data-uid="AnthropicClient.Models.AnthropicModels.ClaudeSonnet40">
ClaudeSonnet40
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L81"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 4 Sonnet model.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string ClaudeSonnet40 = &quot;claude-sonnet-4-0&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_AnthropicModels_ClaudeSonnet420250514" data-uid="AnthropicClient.Models.AnthropicModels.ClaudeSonnet420250514">
ClaudeSonnet420250514
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/AnthropicModels.cs/#L76"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The Claude 4 Sonnet model.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string ClaudeSonnet420250514 = &quot;claude-sonnet-4-20250514&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
@@ -0,0 +1,377 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class CreateFileRequest | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class CreateFileRequest | AnthropicClient ">
<meta name="description" content="Represents a request to create a file via the Anthropic Files API.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_CreateFileRequest.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.CreateFileRequest%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.CreateFileRequest">
<h1 id="AnthropicClient_Models_CreateFileRequest" data-uid="AnthropicClient.Models.CreateFileRequest" class="text-break">
Class CreateFileRequest <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L8"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a request to create a file via the Anthropic Files API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class CreateFileRequest</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">CreateFileRequest</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="constructors">Constructors
</h2>
<a id="AnthropicClient_Models_CreateFileRequest__ctor_" data-uid="AnthropicClient.Models.CreateFileRequest.#ctor*"></a>
<h3 id="AnthropicClient_Models_CreateFileRequest__ctor_System_Byte___System_String_System_String_" data-uid="AnthropicClient.Models.CreateFileRequest.#ctor(System.Byte[],System.String,System.String)">
CreateFileRequest(byte[], string, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L33"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.CreateFileRequest.html">CreateFileRequest</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public CreateFileRequest(byte[] file, string fileName, string fileType)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>file</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
<dd><p>The file content as a byte array.</p>
</dd>
<dt><code>fileName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The original filename of the file being uploaded.</p>
</dd>
<dt><code>fileType</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The MIME type of the file.</p>
</dd>
</dl>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">file</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when <code class="paramref">fileName</code> or <code class="paramref">fileType</code> is null or whitespace.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_CreateFileRequest__ctor_" data-uid="AnthropicClient.Models.CreateFileRequest.#ctor*"></a>
<h3 id="AnthropicClient_Models_CreateFileRequest__ctor_System_IO_Stream_System_String_System_String_" data-uid="AnthropicClient.Models.CreateFileRequest.#ctor(System.IO.Stream,System.String,System.String)">
CreateFileRequest(Stream, string, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L52"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.CreateFileRequest.html">CreateFileRequest</a> class from a stream.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public CreateFileRequest(Stream stream, string fileName, string fileType)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>stream</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a></dt>
<dd><p>The stream containing the file content.</p>
</dd>
<dt><code>fileName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The original filename of the file being uploaded.</p>
</dd>
<dt><code>fileType</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The MIME type of the file.</p>
</dd>
</dl>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">stream</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when <code class="paramref">fileName</code> or <code class="paramref">fileType</code> is null or whitespace.</p>
</dd>
</dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_CreateFileRequest_File_" data-uid="AnthropicClient.Models.CreateFileRequest.File*"></a>
<h3 id="AnthropicClient_Models_CreateFileRequest_File" data-uid="AnthropicClient.Models.CreateFileRequest.File">
File
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L13"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The file content as a byte array.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public byte[] File { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_CreateFileRequest_FileName_" data-uid="AnthropicClient.Models.CreateFileRequest.FileName*"></a>
<h3 id="AnthropicClient_Models_CreateFileRequest_FileName" data-uid="AnthropicClient.Models.CreateFileRequest.FileName">
FileName
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L18"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The original filename of the file being uploaded.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string FileName { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_CreateFileRequest_FileType_" data-uid="AnthropicClient.Models.CreateFileRequest.FileType*"></a>
<h3 id="AnthropicClient_Models_CreateFileRequest_FileType" data-uid="AnthropicClient.Models.CreateFileRequest.FileType">
FileType
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L23"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The MIME type of the file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string FileType { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/CreateFileRequest.cs/#L8" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
@@ -89,7 +89,7 @@
<h1 id="AnthropicClient_Models_DocumentSource" data-uid="AnthropicClient.Models.DocumentSource" class="text-break">
Class DocumentSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L10"><i class="bi bi-code-slash"></i></a>
Class DocumentSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L8"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
@@ -168,7 +168,7 @@ Class DocumentSource <a class="header-action link-secondary" title="View source
<h3 id="AnthropicClient_Models_DocumentSource__ctor_System_String_System_String_" data-uid="AnthropicClient.Models.DocumentSource.#ctor(System.String,System.String)">
DocumentSource(string, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L25"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L23"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.DocumentSource.html">DocumentSource</a> class.</p>
@@ -213,7 +213,7 @@ Class DocumentSource <a class="header-action link-secondary" title="View source
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L10" class="edit-link">Edit this page</a>
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L8" class="edit-link">Edit this page</a>
</div>
@@ -0,0 +1,282 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class FileSource | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class FileSource | AnthropicClient ">
<meta name="description" content="Represents a file source in the Anthropic API.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_FileSource.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.FileSource%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.FileSource">
<h1 id="AnthropicClient_Models_FileSource" data-uid="AnthropicClient.Models.FileSource" class="text-break">
Class FileSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/FileSource.cs/#L8"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a file source in the Anthropic API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class FileSource : Source</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><a class="xref" href="AnthropicClient.Models.Source.html">Source</a></div>
<div><span class="xref">FileSource</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="AnthropicClient.Models.Source.html#AnthropicClient_Models_Source_Type">Source.Type</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="constructors">Constructors
</h2>
<a id="AnthropicClient_Models_FileSource__ctor_" data-uid="AnthropicClient.Models.FileSource.#ctor*"></a>
<h3 id="AnthropicClient_Models_FileSource__ctor" data-uid="AnthropicClient.Models.FileSource.#ctor">
FileSource()
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/FileSource.cs/#L20"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.FileSource.html">FileSource</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public FileSource()</code></pre>
</div>
<a id="AnthropicClient_Models_FileSource__ctor_" data-uid="AnthropicClient.Models.FileSource.#ctor*"></a>
<h3 id="AnthropicClient_Models_FileSource__ctor_System_String_" data-uid="AnthropicClient.Models.FileSource.#ctor(System.String)">
FileSource(string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/FileSource.cs/#L29"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.FileSource.html">FileSource</a> class with a specified file ID.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public FileSource(string id)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>id</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The unique identifier for the file source.</p>
</dd>
</dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_FileSource_Id_" data-uid="AnthropicClient.Models.FileSource.Id*"></a>
<h3 id="AnthropicClient_Models_FileSource_Id" data-uid="AnthropicClient.Models.FileSource.Id">
Id
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/FileSource.cs/#L13"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets or sets the unique identifier for the file source.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;file_id&quot;)]
public string Id { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/FileSource.cs/#L8" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
@@ -160,6 +160,87 @@ Class ImageContent <a class="header-action link-secondary" title="View source"
</h2>
<a id="AnthropicClient_Models_ImageContent__ctor_" data-uid="AnthropicClient.Models.ImageContent.#ctor*"></a>
<h3 id="AnthropicClient_Models_ImageContent__ctor_AnthropicClient_Models_Source_" data-uid="AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source)">
ImageContent(Source)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageContent.cs/#L63"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.ImageContent.html">ImageContent</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ImageContent(Source source)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>source</code> <a class="xref" href="AnthropicClient.Models.Source.html">Source</a></dt>
<dd><p>The source of the image.</p>
</dd>
</dl>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when the source is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_ImageContent__ctor_" data-uid="AnthropicClient.Models.ImageContent.#ctor*"></a>
<h3 id="AnthropicClient_Models_ImageContent__ctor_AnthropicClient_Models_Source_AnthropicClient_Models_CacheControl_" data-uid="AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source,AnthropicClient.Models.CacheControl)">
ImageContent(Source, CacheControl)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageContent.cs/#L77"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.ImageContent.html">ImageContent</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ImageContent(Source source, CacheControl cacheControl)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>source</code> <a class="xref" href="AnthropicClient.Models.Source.html">Source</a></dt>
<dd><p>The source of the image.</p>
</dd>
<dt><code>cacheControl</code> <a class="xref" href="AnthropicClient.Models.CacheControl.html">CacheControl</a></dt>
<dd><p>The cache control to be used for the content.</p>
</dd>
</dl>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when the source or cache control is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_ImageContent__ctor_" data-uid="AnthropicClient.Models.ImageContent.#ctor*"></a>
<h3 id="AnthropicClient_Models_ImageContent__ctor_System_String_System_String_" data-uid="AnthropicClient.Models.ImageContent.#ctor(System.String,System.String)">
@@ -89,7 +89,7 @@
<h1 id="AnthropicClient_Models_ImageSource" data-uid="AnthropicClient.Models.ImageSource" class="text-break">
Class ImageSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L10"><i class="bi bi-code-slash"></i></a>
Class ImageSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L8"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
@@ -168,7 +168,7 @@ Class ImageSource <a class="header-action link-secondary" title="View source" h
<h3 id="AnthropicClient_Models_ImageSource__ctor_System_String_System_String_" data-uid="AnthropicClient.Models.ImageSource.#ctor(System.String,System.String)">
ImageSource(string, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L25"><i class="bi bi-code-slash"></i></a>
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L23"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.ImageSource.html">ImageSource</a> class.</p>
@@ -213,7 +213,7 @@ Class ImageSource <a class="header-action link-secondary" title="View source" h
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L10" class="edit-link">Edit this page</a>
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L8" class="edit-link">Edit this page</a>
</div>
@@ -122,7 +122,9 @@ Class Source <a class="header-action link-secondary" title="View source" href="
<dd>
<div><a class="xref" href="AnthropicClient.Models.Base64Source.html">Base64Source</a></div>
<div><a class="xref" href="AnthropicClient.Models.CustomSource.html">CustomSource</a></div>
<div><a class="xref" href="AnthropicClient.Models.FileSource.html">FileSource</a></div>
<div><a class="xref" href="AnthropicClient.Models.TextSource.html">TextSource</a></div>
<div><a class="xref" href="AnthropicClient.Models.UrlSource.html">UrlSource</a></div>
</dd>
</dl>
@@ -216,6 +216,37 @@ Class SourceType <a class="header-action link-secondary" title="View source" hr
<h3 id="AnthropicClient_Models_SourceType_File" data-uid="AnthropicClient.Models.SourceType.File">
File
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/SourceType.cs/#L26"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The file document source type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string File = &quot;file&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h3 id="AnthropicClient_Models_SourceType_Text" data-uid="AnthropicClient.Models.SourceType.Text">
Text
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/SourceType.cs/#L21"><i class="bi bi-code-slash"></i></a>
@@ -247,6 +278,37 @@ Class SourceType <a class="header-action link-secondary" title="View source" hr
<h3 id="AnthropicClient_Models_SourceType_Url" data-uid="AnthropicClient.Models.SourceType.Url">
Url
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/SourceType.cs/#L31"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>The URL document source type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const string Url = &quot;url&quot;</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
@@ -0,0 +1,281 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class UrlSource | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class UrlSource | AnthropicClient ">
<meta name="description" content="Represents a URL source in the Anthropic API.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/main/apiSpec/new?filename=AnthropicClient_Models_UrlSource.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.UrlSource%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.UrlSource">
<h1 id="AnthropicClient_Models_UrlSource" data-uid="AnthropicClient.Models.UrlSource" class="text-break">
Class UrlSource <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/UrlSource.cs/#L6"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a URL source in the Anthropic API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class UrlSource : Source</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><a class="xref" href="AnthropicClient.Models.Source.html">Source</a></div>
<div><span class="xref">UrlSource</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="AnthropicClient.Models.Source.html#AnthropicClient_Models_Source_Type">Source.Type</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="constructors">Constructors
</h2>
<a id="AnthropicClient_Models_UrlSource__ctor_" data-uid="AnthropicClient.Models.UrlSource.#ctor*"></a>
<h3 id="AnthropicClient_Models_UrlSource__ctor" data-uid="AnthropicClient.Models.UrlSource.#ctor">
UrlSource()
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/UrlSource.cs/#L17"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.UrlSource.html">UrlSource</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public UrlSource()</code></pre>
</div>
<a id="AnthropicClient_Models_UrlSource__ctor_" data-uid="AnthropicClient.Models.UrlSource.#ctor*"></a>
<h3 id="AnthropicClient_Models_UrlSource__ctor_System_String_" data-uid="AnthropicClient.Models.UrlSource.#ctor(System.String)">
UrlSource(string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/UrlSource.cs/#L26"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.Models.UrlSource.html">UrlSource</a> class with a specified URL.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public UrlSource(string url)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>url</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The URL of the source document.</p>
</dd>
</dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_UrlSource_Url_" data-uid="AnthropicClient.Models.UrlSource.Url*"></a>
<h3 id="AnthropicClient_Models_UrlSource_Url" data-uid="AnthropicClient.Models.UrlSource.Url">
Url
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/UrlSource.cs/#L11"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets or sets the URL of the source document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string Url { get; init; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/UrlSource.cs/#L6" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>
+25
View File
@@ -102,6 +102,16 @@ Classes
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.AnthropicEvent.html">AnthropicEvent</a></dt>
<dd><p>Represents an event from the Anthropic API.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a></dt>
<dd><p>Represents a file object from the Anthropic Files API.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a></dt>
<dd><p>Represents the response from deleting a file in the Anthropic API.</p>
</dd>
</dl>
<dl class="jumplist">
@@ -237,6 +247,11 @@ Classes
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.CountMessageTokensRequest.html">CountMessageTokensRequest</a></dt>
<dd><p>Represents a request to count the number of tokens in a message.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.CreateFileRequest.html">CreateFileRequest</a></dt>
<dd><p>Represents a request to create a file via the Anthropic Files API.</p>
</dd>
</dl>
<dl class="jumplist">
@@ -292,6 +307,11 @@ Classes
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.ExpiredMessageBatchResult.html">ExpiredMessageBatchResult</a></dt>
<dd><p>Represents a message batch result that has expired.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.FileSource.html">FileSource</a></dt>
<dd><p>Represents a file source in the Anthropic API.</p>
</dd>
</dl>
<dl class="jumplist">
@@ -557,6 +577,11 @@ Classes
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.ToolUseContent.html">ToolUseContent</a></dt>
<dd><p>Represents tool use content that is part of a message.</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="AnthropicClient.Models.UrlSource.html">UrlSource</a></dt>
<dd><p>Represents a URL source in the Anthropic API.</p>
</dd>
</dl>
<dl class="jumplist">
+15
View File
@@ -36,6 +36,12 @@
<li>
<a href="AnthropicClient.Models.AnthropicEvent.html" name="" title="AnthropicEvent">AnthropicEvent</a>
</li>
<li>
<a href="AnthropicClient.Models.AnthropicFile.html" name="" title="AnthropicFile">AnthropicFile</a>
</li>
<li>
<a href="AnthropicClient.Models.AnthropicFileDeleteResponse.html" name="" title="AnthropicFileDeleteResponse">AnthropicFileDeleteResponse</a>
</li>
<li>
<a href="AnthropicClient.Models.AnthropicFunction.html" name="" title="AnthropicFunction">AnthropicFunction</a>
</li>
@@ -117,6 +123,9 @@
<li>
<a href="AnthropicClient.Models.CountMessageTokensRequest.html" name="" title="CountMessageTokensRequest">CountMessageTokensRequest</a>
</li>
<li>
<a href="AnthropicClient.Models.CreateFileRequest.html" name="" title="CreateFileRequest">CreateFileRequest</a>
</li>
<li>
<a href="AnthropicClient.Models.CustomSource.html" name="" title="CustomSource">CustomSource</a>
</li>
@@ -150,6 +159,9 @@
<li>
<a href="AnthropicClient.Models.ExpiredMessageBatchResult.html" name="" title="ExpiredMessageBatchResult">ExpiredMessageBatchResult</a>
</li>
<li>
<a href="AnthropicClient.Models.FileSource.html" name="" title="FileSource">FileSource</a>
</li>
<li>
<a href="AnthropicClient.Models.FunctionParameterAttribute.html" name="" title="FunctionParameterAttribute">FunctionParameterAttribute</a>
</li>
@@ -312,6 +324,9 @@
<li>
<a href="AnthropicClient.Models.ToolUseContent.html" name="" title="ToolUseContent">ToolUseContent</a>
</li>
<li>
<a href="AnthropicClient.Models.UrlSource.html" name="" title="UrlSource">UrlSource</a>
</li>
<li>
<a href="AnthropicClient.Models.Usage.html" name="" title="Usage">Usage</a>
</li>
+1 -1
View File
File diff suppressed because one or more lines are too long
+113
View File
@@ -227,6 +227,119 @@ if (response.IsFailure)
Console.WriteLine(&quot;Model Id: {0}&quot;, response.Value.Id);
</code></pre>
<h3 id="files-api">Files API</h3>
<p>The <code>AnthropicApiClient</code> provides support for the Anthropic Files API, which allows you to upload and manage files for use with the Anthropic API.</p>
<div class="NOTE">
<h5>Note</h5>
<p>The Files API is currently in beta. To use the Files API, youll need to include the beta feature header: <code>anthropic-beta: files-api-2025-04-14</code></p>
</div>
<h4 id="create-a-file">Create a File</h4>
<p>You can create a file using the Files API in several ways:</p>
<h5 id="from-a-byte-array">From a Byte Array</h5>
<pre><code class="lang-csharp">var fileBytes = await File.ReadAllBytesAsync(&quot;path/to/file.txt&quot;);
var request = new CreateFileRequest(fileBytes, &quot;file.txt&quot;, &quot;text/plain&quot;);
var result = await client.CreateFileAsync(request);
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($&quot;Created file: {file.Name} (ID: {file.Id})&quot;);
}
</code></pre>
<h5 id="from-a-stream">From a Stream</h5>
<pre><code class="lang-csharp">using var fileStream = File.OpenRead(&quot;path/to/file.txt&quot;);
var request = new CreateFileRequest(fileStream, &quot;file.txt&quot;, &quot;text/plain&quot;);
var result = await client.CreateFileAsync(request);
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($&quot;Created file: {file.Name} (ID: {file.Id})&quot;);
}
</code></pre>
<h4 id="list-files">List Files</h4>
<p>You can list files in your account using pagination:</p>
<h5 id="single-page">Single Page</h5>
<pre><code class="lang-csharp">var result = await client.ListFilesAsync();
if (result.IsSuccess)
{
var page = result.Value;
Console.WriteLine($&quot;Found {page.Data.Count} files&quot;);
foreach (var file in page.Data)
{
Console.WriteLine($&quot;- {file.Name} (ID: {file.Id}, Size: {file.Size} bytes)&quot;);
}
if (page.HasMore)
{
Console.WriteLine(&quot;More files available...&quot;);
}
}
</code></pre>
<h5 id="with-pagination-options">With Pagination Options</h5>
<pre><code class="lang-csharp">var pagingRequest = new PagingRequest(afterId: &quot;file_12345&quot;, limit: 10);
var result = await client.ListFilesAsync(pagingRequest);
</code></pre>
<h5 id="all-files-multiple-pages">All Files (Multiple Pages)</h5>
<pre><code class="lang-csharp">await foreach (var pageResult in client.ListAllFilesAsync(limit: 20))
{
if (pageResult.IsSuccess)
{
var page = pageResult.Value;
foreach (var file in page.Data)
{
Console.WriteLine($&quot;- {file.Name} (ID: {file.Id})&quot;);
}
}
}
</code></pre>
<h4 id="get-file-information">Get File Information</h4>
<p>Retrieve metadata about a specific file:</p>
<pre><code class="lang-csharp">var result = await client.GetFileInfoAsync(&quot;file_12345&quot;);
if (result.IsSuccess)
{
var file = result.Value;
Console.WriteLine($&quot;File: {file.Name}&quot;);
Console.WriteLine($&quot;ID: {file.Id}&quot;);
Console.WriteLine($&quot;MIME Type: {file.MimeType}&quot;);
Console.WriteLine($&quot;Size: {file.Size} bytes&quot;);
Console.WriteLine($&quot;Created: {file.CreatedAt}&quot;);
Console.WriteLine($&quot;Downloadable: {file.Downloadable}&quot;);
}
</code></pre>
<h4 id="get-file-content">Get File Content</h4>
<p>Download the content of a file as a stream:</p>
<pre><code class="lang-csharp">var result = await client.GetFileAsync(&quot;file_12345&quot;);
if (result.IsSuccess)
{
using var contentStream = result.Value;
using var reader = new StreamReader(contentStream);
var content = await reader.ReadToEndAsync();
Console.WriteLine(&quot;File content:&quot;);
Console.WriteLine(content);
}
</code></pre>
<h4 id="delete-a-file">Delete a File</h4>
<p>Remove a file from your account:</p>
<pre><code class="lang-csharp">var result = await client.DeleteFileAsync(&quot;file_12345&quot;);
if (result.IsSuccess)
{
var deleteResponse = result.Value;
Console.WriteLine($&quot;Deleted file: {deleteResponse.Id}&quot;);
Console.WriteLine($&quot;Type: {deleteResponse.Type}&quot;);
}
</code></pre>
<div class="NOTE">
<h5>Note</h5>
<p>The Files API has certain limitations on file size, supported file types, and usage quotas. Please refer to the <a href="https://docs.anthropic.com/en/docs/build-with-claude/files">Anthropic API Documentation</a> for the most up-to-date information on these limitations.</p>
</div>
<h3 id="create-a-message">Create a message</h3>
<p>The <code>AnthropicApiClient</code> exposes a method named <code>CreateMessageAsync</code> that can be used to create a message. The method requires a <code>MessageRequest</code> or a <code>StreamMessageRequest</code> instance as a parameter. The <code>MessageRequest</code> class is used to create a message whose response is not streamed and the <code>StreamMessageRequest</code> class is used to create a message whose response is streamed. The <code>MessageRequest</code> instance's properties can be set to configure how the message is created.</p>
<h4 id="non-streaming">Non-Streaming</h4>
+33 -8
View File
File diff suppressed because one or more lines are too long
+70
View File
@@ -66,6 +66,34 @@
"Title": "AnthropicClient.Models.AnthropicEvent",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.AnthropicEvent.yml\" sourcestartlinenumber=\"1\">Represents an event from the Anthropic API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.AnthropicFile.yml",
"output": {
".html": {
"relative_path": "api/AnthropicClient.Models.AnthropicFile.html"
}
},
"version": "",
"Uid": null,
"IsMRef": true,
"Title": "AnthropicClient.Models.AnthropicFile",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.AnthropicFile.yml\" sourcestartlinenumber=\"1\">Represents a file object from the Anthropic Files API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.AnthropicFileDeleteResponse.yml",
"output": {
".html": {
"relative_path": "api/AnthropicClient.Models.AnthropicFileDeleteResponse.html"
}
},
"version": "",
"Uid": null,
"IsMRef": true,
"Title": "AnthropicClient.Models.AnthropicFileDeleteResponse",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.AnthropicFileDeleteResponse.yml\" sourcestartlinenumber=\"1\">Represents the response from deleting a file in the Anthropic API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.AnthropicFunction.yml",
@@ -444,6 +472,20 @@
"Title": "AnthropicClient.Models.CountMessageTokensRequest",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.CountMessageTokensRequest.yml\" sourcestartlinenumber=\"1\">Represents a request to count the number of tokens in a message.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.CreateFileRequest.yml",
"output": {
".html": {
"relative_path": "api/AnthropicClient.Models.CreateFileRequest.html"
}
},
"version": "",
"Uid": null,
"IsMRef": true,
"Title": "AnthropicClient.Models.CreateFileRequest",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.CreateFileRequest.yml\" sourcestartlinenumber=\"1\">Represents a request to create a file via the Anthropic Files API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.CustomSource.yml",
@@ -598,6 +640,20 @@
"Title": "AnthropicClient.Models.ExpiredMessageBatchResult",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.ExpiredMessageBatchResult.yml\" sourcestartlinenumber=\"1\">Represents a message batch result that has expired.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.FileSource.yml",
"output": {
".html": {
"relative_path": "api/AnthropicClient.Models.FileSource.html"
}
},
"version": "",
"Uid": null,
"IsMRef": true,
"Title": "AnthropicClient.Models.FileSource",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.FileSource.yml\" sourcestartlinenumber=\"1\">Represents a file source in the Anthropic API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.FunctionParameterAttribute.yml",
@@ -1354,6 +1410,20 @@
"Title": "AnthropicClient.Models.ToolUseContent",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.ToolUseContent.yml\" sourcestartlinenumber=\"1\">Represents tool use content that is part of a message.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.UrlSource.yml",
"output": {
".html": {
"relative_path": "api/AnthropicClient.Models.UrlSource.html"
}
},
"version": "",
"Uid": null,
"IsMRef": true,
"Title": "AnthropicClient.Models.UrlSource",
"Summary": "<p sourcefile=\"api/AnthropicClient.Models.UrlSource.yml\" sourcestartlinenumber=\"1\">Represents a URL source in the Anthropic API.</p>\n"
},
{
"type": "ManagedReference",
"source_relative_path": "api/AnthropicClient.Models.Usage.yml",
+548
View File
@@ -61,6 +61,19 @@ references:
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.CountMessageTokensAsync
nameWithType: AnthropicApiClient.CountMessageTokensAsync
- uid: AnthropicClient.AnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)
name: CreateFileAsync(CreateFileRequest, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CreateFileAsync_AnthropicClient_Models_CreateFileRequest_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.CreateFileAsync(CreateFileRequest, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.CreateFileAsync*
name: CreateFileAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CreateFileAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.CreateFileAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.CreateFileAsync
nameWithType: AnthropicApiClient.CreateFileAsync
- uid: AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest,System.Threading.CancellationToken)
name: CreateMessageAsync(MessageRequest, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_System_Threading_CancellationToken_
@@ -93,6 +106,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.CreateMessageBatchAsync
nameWithType: AnthropicApiClient.CreateMessageBatchAsync
- uid: AnthropicClient.AnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)
name: DeleteFileAsync(string, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_DeleteFileAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)
name.vb: DeleteFileAsync(String, CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.DeleteFileAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.AnthropicApiClient.DeleteFileAsync(String, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.DeleteFileAsync(string, CancellationToken)
nameWithType.vb: AnthropicApiClient.DeleteFileAsync(String, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.DeleteFileAsync*
name: DeleteFileAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_DeleteFileAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.DeleteFileAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.DeleteFileAsync
nameWithType: AnthropicApiClient.DeleteFileAsync
- uid: AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync(System.String,System.Threading.CancellationToken)
name: DeleteMessageBatchAsync(string, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_DeleteMessageBatchAsync_System_String_System_Threading_CancellationToken_
@@ -109,6 +138,38 @@ references:
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync
nameWithType: AnthropicApiClient.DeleteMessageBatchAsync
- uid: AnthropicClient.AnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)
name: GetFileAsync(string, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetFileAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)
name.vb: GetFileAsync(String, CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.GetFileAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.AnthropicApiClient.GetFileAsync(String, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.GetFileAsync(string, CancellationToken)
nameWithType.vb: AnthropicApiClient.GetFileAsync(String, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.GetFileAsync*
name: GetFileAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetFileAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.GetFileAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.GetFileAsync
nameWithType: AnthropicApiClient.GetFileAsync
- uid: AnthropicClient.AnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)
name: GetFileInfoAsync(string, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetFileInfoAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)
name.vb: GetFileInfoAsync(String, CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.GetFileInfoAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.AnthropicApiClient.GetFileInfoAsync(String, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.GetFileInfoAsync(string, CancellationToken)
nameWithType.vb: AnthropicApiClient.GetFileInfoAsync(String, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.GetFileInfoAsync*
name: GetFileInfoAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetFileInfoAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.GetFileInfoAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.GetFileInfoAsync
nameWithType: AnthropicApiClient.GetFileInfoAsync
- uid: AnthropicClient.AnthropicApiClient.GetMessageBatchAsync(System.String,System.Threading.CancellationToken)
name: GetMessageBatchAsync(string, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_GetMessageBatchAsync_System_String_System_Threading_CancellationToken_
@@ -157,6 +218,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.GetModelAsync
nameWithType: AnthropicApiClient.GetModelAsync
- uid: AnthropicClient.AnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)
name: ListAllFilesAsync(int, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListAllFilesAsync_System_Int32_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)
name.vb: ListAllFilesAsync(Integer, CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.ListAllFilesAsync(int, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.AnthropicApiClient.ListAllFilesAsync(Integer, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.ListAllFilesAsync(int, CancellationToken)
nameWithType.vb: AnthropicApiClient.ListAllFilesAsync(Integer, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.ListAllFilesAsync*
name: ListAllFilesAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListAllFilesAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.ListAllFilesAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.ListAllFilesAsync
nameWithType: AnthropicApiClient.ListAllFilesAsync
- uid: AnthropicClient.AnthropicApiClient.ListAllMessageBatchesAsync(System.Int32,System.Threading.CancellationToken)
name: ListAllMessageBatchesAsync(int, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListAllMessageBatchesAsync_System_Int32_System_Threading_CancellationToken_
@@ -189,6 +266,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.ListAllModelsAsync
nameWithType: AnthropicApiClient.ListAllModelsAsync
- uid: AnthropicClient.AnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name: ListFilesAsync(PagingRequest?, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListFilesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_
commentId: M:AnthropicClient.AnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name.vb: ListFilesAsync(PagingRequest, CancellationToken)
fullName: AnthropicClient.AnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest?, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.AnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest, System.Threading.CancellationToken)
nameWithType: AnthropicApiClient.ListFilesAsync(PagingRequest?, CancellationToken)
nameWithType.vb: AnthropicApiClient.ListFilesAsync(PagingRequest, CancellationToken)
- uid: AnthropicClient.AnthropicApiClient.ListFilesAsync*
name: ListFilesAsync
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListFilesAsync_
commentId: Overload:AnthropicClient.AnthropicApiClient.ListFilesAsync
isSpec: "True"
fullName: AnthropicClient.AnthropicApiClient.ListFilesAsync
nameWithType: AnthropicApiClient.ListFilesAsync
- uid: AnthropicClient.AnthropicApiClient.ListMessageBatchesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name: ListMessageBatchesAsync(PagingRequest?, CancellationToken)
href: api/AnthropicClient.AnthropicApiClient.html#AnthropicClient_AnthropicApiClient_ListMessageBatchesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_
@@ -256,6 +349,19 @@ references:
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.CountMessageTokensAsync
nameWithType: IAnthropicApiClient.CountMessageTokensAsync
- uid: AnthropicClient.IAnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)
name: CreateFileAsync(CreateFileRequest, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CreateFileAsync_AnthropicClient_Models_CreateFileRequest_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest,System.Threading.CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.CreateFileAsync(AnthropicClient.Models.CreateFileRequest, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.CreateFileAsync(CreateFileRequest, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.CreateFileAsync*
name: CreateFileAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CreateFileAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.CreateFileAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.CreateFileAsync
nameWithType: IAnthropicApiClient.CreateFileAsync
- uid: AnthropicClient.IAnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest,System.Threading.CancellationToken)
name: CreateMessageAsync(MessageRequest, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_System_Threading_CancellationToken_
@@ -288,6 +394,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.CreateMessageBatchAsync
nameWithType: IAnthropicApiClient.CreateMessageBatchAsync
- uid: AnthropicClient.IAnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)
name: DeleteFileAsync(string, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_DeleteFileAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.DeleteFileAsync(System.String,System.Threading.CancellationToken)
name.vb: DeleteFileAsync(String, CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.DeleteFileAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.IAnthropicApiClient.DeleteFileAsync(String, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.DeleteFileAsync(string, CancellationToken)
nameWithType.vb: IAnthropicApiClient.DeleteFileAsync(String, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.DeleteFileAsync*
name: DeleteFileAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_DeleteFileAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.DeleteFileAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.DeleteFileAsync
nameWithType: IAnthropicApiClient.DeleteFileAsync
- uid: AnthropicClient.IAnthropicApiClient.DeleteMessageBatchAsync(System.String,System.Threading.CancellationToken)
name: DeleteMessageBatchAsync(string, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_DeleteMessageBatchAsync_System_String_System_Threading_CancellationToken_
@@ -304,6 +426,38 @@ references:
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.DeleteMessageBatchAsync
nameWithType: IAnthropicApiClient.DeleteMessageBatchAsync
- uid: AnthropicClient.IAnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)
name: GetFileAsync(string, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetFileAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.GetFileAsync(System.String,System.Threading.CancellationToken)
name.vb: GetFileAsync(String, CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.GetFileAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.IAnthropicApiClient.GetFileAsync(String, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.GetFileAsync(string, CancellationToken)
nameWithType.vb: IAnthropicApiClient.GetFileAsync(String, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.GetFileAsync*
name: GetFileAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetFileAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.GetFileAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.GetFileAsync
nameWithType: IAnthropicApiClient.GetFileAsync
- uid: AnthropicClient.IAnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)
name: GetFileInfoAsync(string, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetFileInfoAsync_System_String_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.GetFileInfoAsync(System.String,System.Threading.CancellationToken)
name.vb: GetFileInfoAsync(String, CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.GetFileInfoAsync(string, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.IAnthropicApiClient.GetFileInfoAsync(String, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.GetFileInfoAsync(string, CancellationToken)
nameWithType.vb: IAnthropicApiClient.GetFileInfoAsync(String, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.GetFileInfoAsync*
name: GetFileInfoAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetFileInfoAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.GetFileInfoAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.GetFileInfoAsync
nameWithType: IAnthropicApiClient.GetFileInfoAsync
- uid: AnthropicClient.IAnthropicApiClient.GetMessageBatchAsync(System.String,System.Threading.CancellationToken)
name: GetMessageBatchAsync(string, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_GetMessageBatchAsync_System_String_System_Threading_CancellationToken_
@@ -352,6 +506,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.GetModelAsync
nameWithType: IAnthropicApiClient.GetModelAsync
- uid: AnthropicClient.IAnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)
name: ListAllFilesAsync(int, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListAllFilesAsync_System_Int32_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.ListAllFilesAsync(System.Int32,System.Threading.CancellationToken)
name.vb: ListAllFilesAsync(Integer, CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.ListAllFilesAsync(int, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.IAnthropicApiClient.ListAllFilesAsync(Integer, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.ListAllFilesAsync(int, CancellationToken)
nameWithType.vb: IAnthropicApiClient.ListAllFilesAsync(Integer, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.ListAllFilesAsync*
name: ListAllFilesAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListAllFilesAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.ListAllFilesAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.ListAllFilesAsync
nameWithType: IAnthropicApiClient.ListAllFilesAsync
- uid: AnthropicClient.IAnthropicApiClient.ListAllMessageBatchesAsync(System.Int32,System.Threading.CancellationToken)
name: ListAllMessageBatchesAsync(int, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListAllMessageBatchesAsync_System_Int32_System_Threading_CancellationToken_
@@ -384,6 +554,22 @@ references:
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.ListAllModelsAsync
nameWithType: IAnthropicApiClient.ListAllModelsAsync
- uid: AnthropicClient.IAnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name: ListFilesAsync(PagingRequest?, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListFilesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_
commentId: M:AnthropicClient.IAnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name.vb: ListFilesAsync(PagingRequest, CancellationToken)
fullName: AnthropicClient.IAnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest?, System.Threading.CancellationToken)
fullName.vb: AnthropicClient.IAnthropicApiClient.ListFilesAsync(AnthropicClient.Models.PagingRequest, System.Threading.CancellationToken)
nameWithType: IAnthropicApiClient.ListFilesAsync(PagingRequest?, CancellationToken)
nameWithType.vb: IAnthropicApiClient.ListFilesAsync(PagingRequest, CancellationToken)
- uid: AnthropicClient.IAnthropicApiClient.ListFilesAsync*
name: ListFilesAsync
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListFilesAsync_
commentId: Overload:AnthropicClient.IAnthropicApiClient.ListFilesAsync
isSpec: "True"
fullName: AnthropicClient.IAnthropicApiClient.ListFilesAsync
nameWithType: IAnthropicApiClient.ListFilesAsync
- uid: AnthropicClient.IAnthropicApiClient.ListMessageBatchesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)
name: ListMessageBatchesAsync(PagingRequest?, CancellationToken)
href: api/AnthropicClient.IAnthropicApiClient.html#AnthropicClient_IAnthropicApiClient_ListMessageBatchesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_
@@ -524,6 +710,135 @@ references:
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicEvent.Type
nameWithType: AnthropicEvent.Type
- uid: AnthropicClient.Models.AnthropicFile
name: AnthropicFile
href: api/AnthropicClient.Models.AnthropicFile.html
commentId: T:AnthropicClient.Models.AnthropicFile
fullName: AnthropicClient.Models.AnthropicFile
nameWithType: AnthropicFile
- uid: AnthropicClient.Models.AnthropicFile.CreatedAt
name: CreatedAt
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_CreatedAt
commentId: P:AnthropicClient.Models.AnthropicFile.CreatedAt
fullName: AnthropicClient.Models.AnthropicFile.CreatedAt
nameWithType: AnthropicFile.CreatedAt
- uid: AnthropicClient.Models.AnthropicFile.CreatedAt*
name: CreatedAt
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_CreatedAt_
commentId: Overload:AnthropicClient.Models.AnthropicFile.CreatedAt
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.CreatedAt
nameWithType: AnthropicFile.CreatedAt
- uid: AnthropicClient.Models.AnthropicFile.Downloadable
name: Downloadable
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Downloadable
commentId: P:AnthropicClient.Models.AnthropicFile.Downloadable
fullName: AnthropicClient.Models.AnthropicFile.Downloadable
nameWithType: AnthropicFile.Downloadable
- uid: AnthropicClient.Models.AnthropicFile.Downloadable*
name: Downloadable
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Downloadable_
commentId: Overload:AnthropicClient.Models.AnthropicFile.Downloadable
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.Downloadable
nameWithType: AnthropicFile.Downloadable
- uid: AnthropicClient.Models.AnthropicFile.Id
name: Id
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Id
commentId: P:AnthropicClient.Models.AnthropicFile.Id
fullName: AnthropicClient.Models.AnthropicFile.Id
nameWithType: AnthropicFile.Id
- uid: AnthropicClient.Models.AnthropicFile.Id*
name: Id
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Id_
commentId: Overload:AnthropicClient.Models.AnthropicFile.Id
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.Id
nameWithType: AnthropicFile.Id
- uid: AnthropicClient.Models.AnthropicFile.MimeType
name: MimeType
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_MimeType
commentId: P:AnthropicClient.Models.AnthropicFile.MimeType
fullName: AnthropicClient.Models.AnthropicFile.MimeType
nameWithType: AnthropicFile.MimeType
- uid: AnthropicClient.Models.AnthropicFile.MimeType*
name: MimeType
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_MimeType_
commentId: Overload:AnthropicClient.Models.AnthropicFile.MimeType
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.MimeType
nameWithType: AnthropicFile.MimeType
- uid: AnthropicClient.Models.AnthropicFile.Name
name: Name
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Name
commentId: P:AnthropicClient.Models.AnthropicFile.Name
fullName: AnthropicClient.Models.AnthropicFile.Name
nameWithType: AnthropicFile.Name
- uid: AnthropicClient.Models.AnthropicFile.Name*
name: Name
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Name_
commentId: Overload:AnthropicClient.Models.AnthropicFile.Name
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.Name
nameWithType: AnthropicFile.Name
- uid: AnthropicClient.Models.AnthropicFile.Size
name: Size
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Size
commentId: P:AnthropicClient.Models.AnthropicFile.Size
fullName: AnthropicClient.Models.AnthropicFile.Size
nameWithType: AnthropicFile.Size
- uid: AnthropicClient.Models.AnthropicFile.Size*
name: Size
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Size_
commentId: Overload:AnthropicClient.Models.AnthropicFile.Size
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.Size
nameWithType: AnthropicFile.Size
- uid: AnthropicClient.Models.AnthropicFile.Type
name: Type
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Type
commentId: P:AnthropicClient.Models.AnthropicFile.Type
fullName: AnthropicClient.Models.AnthropicFile.Type
nameWithType: AnthropicFile.Type
- uid: AnthropicClient.Models.AnthropicFile.Type*
name: Type
href: api/AnthropicClient.Models.AnthropicFile.html#AnthropicClient_Models_AnthropicFile_Type_
commentId: Overload:AnthropicClient.Models.AnthropicFile.Type
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFile.Type
nameWithType: AnthropicFile.Type
- uid: AnthropicClient.Models.AnthropicFileDeleteResponse
name: AnthropicFileDeleteResponse
href: api/AnthropicClient.Models.AnthropicFileDeleteResponse.html
commentId: T:AnthropicClient.Models.AnthropicFileDeleteResponse
fullName: AnthropicClient.Models.AnthropicFileDeleteResponse
nameWithType: AnthropicFileDeleteResponse
- uid: AnthropicClient.Models.AnthropicFileDeleteResponse.Id
name: Id
href: api/AnthropicClient.Models.AnthropicFileDeleteResponse.html#AnthropicClient_Models_AnthropicFileDeleteResponse_Id
commentId: P:AnthropicClient.Models.AnthropicFileDeleteResponse.Id
fullName: AnthropicClient.Models.AnthropicFileDeleteResponse.Id
nameWithType: AnthropicFileDeleteResponse.Id
- uid: AnthropicClient.Models.AnthropicFileDeleteResponse.Id*
name: Id
href: api/AnthropicClient.Models.AnthropicFileDeleteResponse.html#AnthropicClient_Models_AnthropicFileDeleteResponse_Id_
commentId: Overload:AnthropicClient.Models.AnthropicFileDeleteResponse.Id
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFileDeleteResponse.Id
nameWithType: AnthropicFileDeleteResponse.Id
- uid: AnthropicClient.Models.AnthropicFileDeleteResponse.Type
name: Type
href: api/AnthropicClient.Models.AnthropicFileDeleteResponse.html#AnthropicClient_Models_AnthropicFileDeleteResponse_Type
commentId: P:AnthropicClient.Models.AnthropicFileDeleteResponse.Type
fullName: AnthropicClient.Models.AnthropicFileDeleteResponse.Type
nameWithType: AnthropicFileDeleteResponse.Type
- uid: AnthropicClient.Models.AnthropicFileDeleteResponse.Type*
name: Type
href: api/AnthropicClient.Models.AnthropicFileDeleteResponse.html#AnthropicClient_Models_AnthropicFileDeleteResponse_Type_
commentId: Overload:AnthropicClient.Models.AnthropicFileDeleteResponse.Type
isSpec: "True"
fullName: AnthropicClient.Models.AnthropicFileDeleteResponse.Type
nameWithType: AnthropicFileDeleteResponse.Type
- uid: AnthropicClient.Models.AnthropicFunction
name: AnthropicFunction
href: api/AnthropicClient.Models.AnthropicFunction.html
@@ -785,6 +1100,18 @@ references:
commentId: F:AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest
fullName: AnthropicClient.Models.AnthropicModels.Claude35SonnetLatest
nameWithType: AnthropicModels.Claude35SonnetLatest
- uid: AnthropicClient.Models.AnthropicModels.Claude37Sonnet20250219
name: Claude37Sonnet20250219
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude37Sonnet20250219
commentId: F:AnthropicClient.Models.AnthropicModels.Claude37Sonnet20250219
fullName: AnthropicClient.Models.AnthropicModels.Claude37Sonnet20250219
nameWithType: AnthropicModels.Claude37Sonnet20250219
- uid: AnthropicClient.Models.AnthropicModels.Claude37SonnetLatest
name: Claude37SonnetLatest
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude37SonnetLatest
commentId: F:AnthropicClient.Models.AnthropicModels.Claude37SonnetLatest
fullName: AnthropicClient.Models.AnthropicModels.Claude37SonnetLatest
nameWithType: AnthropicModels.Claude37SonnetLatest
- uid: AnthropicClient.Models.AnthropicModels.Claude3Haiku
name: Claude3Haiku
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_Claude3Haiku
@@ -827,6 +1154,30 @@ references:
commentId: F:AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229
fullName: AnthropicClient.Models.AnthropicModels.Claude3Sonnet20240229
nameWithType: AnthropicModels.Claude3Sonnet20240229
- uid: AnthropicClient.Models.AnthropicModels.ClaudeOpus40
name: ClaudeOpus40
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_ClaudeOpus40
commentId: F:AnthropicClient.Models.AnthropicModels.ClaudeOpus40
fullName: AnthropicClient.Models.AnthropicModels.ClaudeOpus40
nameWithType: AnthropicModels.ClaudeOpus40
- uid: AnthropicClient.Models.AnthropicModels.ClaudeOpus420250514
name: ClaudeOpus420250514
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_ClaudeOpus420250514
commentId: F:AnthropicClient.Models.AnthropicModels.ClaudeOpus420250514
fullName: AnthropicClient.Models.AnthropicModels.ClaudeOpus420250514
nameWithType: AnthropicModels.ClaudeOpus420250514
- uid: AnthropicClient.Models.AnthropicModels.ClaudeSonnet40
name: ClaudeSonnet40
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_ClaudeSonnet40
commentId: F:AnthropicClient.Models.AnthropicModels.ClaudeSonnet40
fullName: AnthropicClient.Models.AnthropicModels.ClaudeSonnet40
nameWithType: AnthropicModels.ClaudeSonnet40
- uid: AnthropicClient.Models.AnthropicModels.ClaudeSonnet420250514
name: ClaudeSonnet420250514
href: api/AnthropicClient.Models.AnthropicModels.html#AnthropicClient_Models_AnthropicModels_ClaudeSonnet420250514
commentId: F:AnthropicClient.Models.AnthropicModels.ClaudeSonnet420250514
fullName: AnthropicClient.Models.AnthropicModels.ClaudeSonnet420250514
nameWithType: AnthropicModels.ClaudeSonnet420250514
- uid: AnthropicClient.Models.AnyToolChoice
name: AnyToolChoice
href: api/AnthropicClient.Models.AnyToolChoice.html
@@ -1908,6 +2259,79 @@ references:
isSpec: "True"
fullName: AnthropicClient.Models.CountMessageTokensRequest.Tools
nameWithType: CountMessageTokensRequest.Tools
- uid: AnthropicClient.Models.CreateFileRequest
name: CreateFileRequest
href: api/AnthropicClient.Models.CreateFileRequest.html
commentId: T:AnthropicClient.Models.CreateFileRequest
fullName: AnthropicClient.Models.CreateFileRequest
nameWithType: CreateFileRequest
- uid: AnthropicClient.Models.CreateFileRequest.#ctor(System.Byte[],System.String,System.String)
name: CreateFileRequest(byte[], string, string)
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest__ctor_System_Byte___System_String_System_String_
commentId: M:AnthropicClient.Models.CreateFileRequest.#ctor(System.Byte[],System.String,System.String)
name.vb: New(Byte(), String, String)
fullName: AnthropicClient.Models.CreateFileRequest.CreateFileRequest(byte[], string, string)
fullName.vb: AnthropicClient.Models.CreateFileRequest.New(Byte(), String, String)
nameWithType: CreateFileRequest.CreateFileRequest(byte[], string, string)
nameWithType.vb: CreateFileRequest.New(Byte(), String, String)
- uid: AnthropicClient.Models.CreateFileRequest.#ctor(System.IO.Stream,System.String,System.String)
name: CreateFileRequest(Stream, string, string)
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest__ctor_System_IO_Stream_System_String_System_String_
commentId: M:AnthropicClient.Models.CreateFileRequest.#ctor(System.IO.Stream,System.String,System.String)
name.vb: New(Stream, String, String)
fullName: AnthropicClient.Models.CreateFileRequest.CreateFileRequest(System.IO.Stream, string, string)
fullName.vb: AnthropicClient.Models.CreateFileRequest.New(System.IO.Stream, String, String)
nameWithType: CreateFileRequest.CreateFileRequest(Stream, string, string)
nameWithType.vb: CreateFileRequest.New(Stream, String, String)
- uid: AnthropicClient.Models.CreateFileRequest.#ctor*
name: CreateFileRequest
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest__ctor_
commentId: Overload:AnthropicClient.Models.CreateFileRequest.#ctor
isSpec: "True"
name.vb: New
fullName: AnthropicClient.Models.CreateFileRequest.CreateFileRequest
fullName.vb: AnthropicClient.Models.CreateFileRequest.New
nameWithType: CreateFileRequest.CreateFileRequest
nameWithType.vb: CreateFileRequest.New
- uid: AnthropicClient.Models.CreateFileRequest.File
name: File
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_File
commentId: P:AnthropicClient.Models.CreateFileRequest.File
fullName: AnthropicClient.Models.CreateFileRequest.File
nameWithType: CreateFileRequest.File
- uid: AnthropicClient.Models.CreateFileRequest.File*
name: File
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_File_
commentId: Overload:AnthropicClient.Models.CreateFileRequest.File
isSpec: "True"
fullName: AnthropicClient.Models.CreateFileRequest.File
nameWithType: CreateFileRequest.File
- uid: AnthropicClient.Models.CreateFileRequest.FileName
name: FileName
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_FileName
commentId: P:AnthropicClient.Models.CreateFileRequest.FileName
fullName: AnthropicClient.Models.CreateFileRequest.FileName
nameWithType: CreateFileRequest.FileName
- uid: AnthropicClient.Models.CreateFileRequest.FileName*
name: FileName
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_FileName_
commentId: Overload:AnthropicClient.Models.CreateFileRequest.FileName
isSpec: "True"
fullName: AnthropicClient.Models.CreateFileRequest.FileName
nameWithType: CreateFileRequest.FileName
- uid: AnthropicClient.Models.CreateFileRequest.FileType
name: FileType
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_FileType
commentId: P:AnthropicClient.Models.CreateFileRequest.FileType
fullName: AnthropicClient.Models.CreateFileRequest.FileType
nameWithType: CreateFileRequest.FileType
- uid: AnthropicClient.Models.CreateFileRequest.FileType*
name: FileType
href: api/AnthropicClient.Models.CreateFileRequest.html#AnthropicClient_Models_CreateFileRequest_FileType_
commentId: Overload:AnthropicClient.Models.CreateFileRequest.FileType
isSpec: "True"
fullName: AnthropicClient.Models.CreateFileRequest.FileType
nameWithType: CreateFileRequest.FileType
- uid: AnthropicClient.Models.CustomSource
name: CustomSource
href: api/AnthropicClient.Models.CustomSource.html
@@ -2398,6 +2822,53 @@ references:
fullName.vb: AnthropicClient.Models.ExpiredMessageBatchResult.New
nameWithType: ExpiredMessageBatchResult.ExpiredMessageBatchResult
nameWithType.vb: ExpiredMessageBatchResult.New
- uid: AnthropicClient.Models.FileSource
name: FileSource
href: api/AnthropicClient.Models.FileSource.html
commentId: T:AnthropicClient.Models.FileSource
fullName: AnthropicClient.Models.FileSource
nameWithType: FileSource
- uid: AnthropicClient.Models.FileSource.#ctor
name: FileSource()
href: api/AnthropicClient.Models.FileSource.html#AnthropicClient_Models_FileSource__ctor
commentId: M:AnthropicClient.Models.FileSource.#ctor
name.vb: New()
fullName: AnthropicClient.Models.FileSource.FileSource()
fullName.vb: AnthropicClient.Models.FileSource.New()
nameWithType: FileSource.FileSource()
nameWithType.vb: FileSource.New()
- uid: AnthropicClient.Models.FileSource.#ctor(System.String)
name: FileSource(string)
href: api/AnthropicClient.Models.FileSource.html#AnthropicClient_Models_FileSource__ctor_System_String_
commentId: M:AnthropicClient.Models.FileSource.#ctor(System.String)
name.vb: New(String)
fullName: AnthropicClient.Models.FileSource.FileSource(string)
fullName.vb: AnthropicClient.Models.FileSource.New(String)
nameWithType: FileSource.FileSource(string)
nameWithType.vb: FileSource.New(String)
- uid: AnthropicClient.Models.FileSource.#ctor*
name: FileSource
href: api/AnthropicClient.Models.FileSource.html#AnthropicClient_Models_FileSource__ctor_
commentId: Overload:AnthropicClient.Models.FileSource.#ctor
isSpec: "True"
name.vb: New
fullName: AnthropicClient.Models.FileSource.FileSource
fullName.vb: AnthropicClient.Models.FileSource.New
nameWithType: FileSource.FileSource
nameWithType.vb: FileSource.New
- uid: AnthropicClient.Models.FileSource.Id
name: Id
href: api/AnthropicClient.Models.FileSource.html#AnthropicClient_Models_FileSource_Id
commentId: P:AnthropicClient.Models.FileSource.Id
fullName: AnthropicClient.Models.FileSource.Id
nameWithType: FileSource.Id
- uid: AnthropicClient.Models.FileSource.Id*
name: Id
href: api/AnthropicClient.Models.FileSource.html#AnthropicClient_Models_FileSource_Id_
commentId: Overload:AnthropicClient.Models.FileSource.Id
isSpec: "True"
fullName: AnthropicClient.Models.FileSource.Id
nameWithType: FileSource.Id
- uid: AnthropicClient.Models.FunctionParameterAttribute
name: FunctionParameterAttribute
href: api/AnthropicClient.Models.FunctionParameterAttribute.html
@@ -2590,6 +3061,24 @@ references:
commentId: T:AnthropicClient.Models.ImageContent
fullName: AnthropicClient.Models.ImageContent
nameWithType: ImageContent
- uid: AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source)
name: ImageContent(Source)
href: api/AnthropicClient.Models.ImageContent.html#AnthropicClient_Models_ImageContent__ctor_AnthropicClient_Models_Source_
commentId: M:AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source)
name.vb: New(Source)
fullName: AnthropicClient.Models.ImageContent.ImageContent(AnthropicClient.Models.Source)
fullName.vb: AnthropicClient.Models.ImageContent.New(AnthropicClient.Models.Source)
nameWithType: ImageContent.ImageContent(Source)
nameWithType.vb: ImageContent.New(Source)
- uid: AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source,AnthropicClient.Models.CacheControl)
name: ImageContent(Source, CacheControl)
href: api/AnthropicClient.Models.ImageContent.html#AnthropicClient_Models_ImageContent__ctor_AnthropicClient_Models_Source_AnthropicClient_Models_CacheControl_
commentId: M:AnthropicClient.Models.ImageContent.#ctor(AnthropicClient.Models.Source,AnthropicClient.Models.CacheControl)
name.vb: New(Source, CacheControl)
fullName: AnthropicClient.Models.ImageContent.ImageContent(AnthropicClient.Models.Source, AnthropicClient.Models.CacheControl)
fullName.vb: AnthropicClient.Models.ImageContent.New(AnthropicClient.Models.Source, AnthropicClient.Models.CacheControl)
nameWithType: ImageContent.ImageContent(Source, CacheControl)
nameWithType.vb: ImageContent.New(Source, CacheControl)
- uid: AnthropicClient.Models.ImageContent.#ctor(System.String,System.String)
name: ImageContent(string, string)
href: api/AnthropicClient.Models.ImageContent.html#AnthropicClient_Models_ImageContent__ctor_System_String_System_String_
@@ -4129,12 +4618,24 @@ references:
commentId: F:AnthropicClient.Models.SourceType.Content
fullName: AnthropicClient.Models.SourceType.Content
nameWithType: SourceType.Content
- uid: AnthropicClient.Models.SourceType.File
name: File
href: api/AnthropicClient.Models.SourceType.html#AnthropicClient_Models_SourceType_File
commentId: F:AnthropicClient.Models.SourceType.File
fullName: AnthropicClient.Models.SourceType.File
nameWithType: SourceType.File
- uid: AnthropicClient.Models.SourceType.Text
name: Text
href: api/AnthropicClient.Models.SourceType.html#AnthropicClient_Models_SourceType_Text
commentId: F:AnthropicClient.Models.SourceType.Text
fullName: AnthropicClient.Models.SourceType.Text
nameWithType: SourceType.Text
- uid: AnthropicClient.Models.SourceType.Url
name: Url
href: api/AnthropicClient.Models.SourceType.html#AnthropicClient_Models_SourceType_Url
commentId: F:AnthropicClient.Models.SourceType.Url
fullName: AnthropicClient.Models.SourceType.Url
nameWithType: SourceType.Url
- uid: AnthropicClient.Models.SpecificToolChoice
name: SpecificToolChoice
href: api/AnthropicClient.Models.SpecificToolChoice.html
@@ -4990,6 +5491,53 @@ references:
isSpec: "True"
fullName: AnthropicClient.Models.ToolUseContent.Name
nameWithType: ToolUseContent.Name
- uid: AnthropicClient.Models.UrlSource
name: UrlSource
href: api/AnthropicClient.Models.UrlSource.html
commentId: T:AnthropicClient.Models.UrlSource
fullName: AnthropicClient.Models.UrlSource
nameWithType: UrlSource
- uid: AnthropicClient.Models.UrlSource.#ctor
name: UrlSource()
href: api/AnthropicClient.Models.UrlSource.html#AnthropicClient_Models_UrlSource__ctor
commentId: M:AnthropicClient.Models.UrlSource.#ctor
name.vb: New()
fullName: AnthropicClient.Models.UrlSource.UrlSource()
fullName.vb: AnthropicClient.Models.UrlSource.New()
nameWithType: UrlSource.UrlSource()
nameWithType.vb: UrlSource.New()
- uid: AnthropicClient.Models.UrlSource.#ctor(System.String)
name: UrlSource(string)
href: api/AnthropicClient.Models.UrlSource.html#AnthropicClient_Models_UrlSource__ctor_System_String_
commentId: M:AnthropicClient.Models.UrlSource.#ctor(System.String)
name.vb: New(String)
fullName: AnthropicClient.Models.UrlSource.UrlSource(string)
fullName.vb: AnthropicClient.Models.UrlSource.New(String)
nameWithType: UrlSource.UrlSource(string)
nameWithType.vb: UrlSource.New(String)
- uid: AnthropicClient.Models.UrlSource.#ctor*
name: UrlSource
href: api/AnthropicClient.Models.UrlSource.html#AnthropicClient_Models_UrlSource__ctor_
commentId: Overload:AnthropicClient.Models.UrlSource.#ctor
isSpec: "True"
name.vb: New
fullName: AnthropicClient.Models.UrlSource.UrlSource
fullName.vb: AnthropicClient.Models.UrlSource.New
nameWithType: UrlSource.UrlSource
nameWithType.vb: UrlSource.New
- uid: AnthropicClient.Models.UrlSource.Url
name: Url
href: api/AnthropicClient.Models.UrlSource.html#AnthropicClient_Models_UrlSource_Url
commentId: P:AnthropicClient.Models.UrlSource.Url
fullName: AnthropicClient.Models.UrlSource.Url
nameWithType: UrlSource.Url
- uid: AnthropicClient.Models.UrlSource.Url*
name: Url
href: api/AnthropicClient.Models.UrlSource.html#AnthropicClient_Models_UrlSource_Url_
commentId: Overload:AnthropicClient.Models.UrlSource.Url
isSpec: "True"
fullName: AnthropicClient.Models.UrlSource.Url
nameWithType: UrlSource.Url
- uid: AnthropicClient.Models.Usage
name: Usage
href: api/AnthropicClient.Models.Usage.html
+70
View File
@@ -18,6 +18,7 @@ public class AnthropicApiClient : IAnthropicApiClient
private string CountTokensEndpoint => $"{MessagesEndpoint}/count_tokens";
private string MessageBatchesEndpoint => $"{MessagesEndpoint}/batches";
private const string ModelsEndpoint = "models";
private const string FilesEndpoint = "files";
private const string JsonContentType = "application/json";
private const string EventPrefix = "event:";
private const string DataPrefix = "data:";
@@ -380,6 +381,64 @@ public class AnthropicApiClient : IAnthropicApiClient
return await CreateResultAsync<AnthropicModel>(response);
}
/// <inheritdoc/>
public async Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default)
{
var response = await SendFileRequestAsync(FilesEndpoint, request, cancellationToken);
return await CreateResultAsync<AnthropicFile>(response);
}
/// <inheritdoc/>
public async Task<AnthropicResult<Page<AnthropicFile>>> ListFilesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default)
{
var pagingRequest = request ?? new PagingRequest();
var endpoint = $"{FilesEndpoint}?{pagingRequest.ToQueryParameters()}";
var response = await SendRequestAsync(endpoint, cancellationToken: cancellationToken);
return await CreateResultAsync<Page<AnthropicFile>>(response);
}
/// <inheritdoc/>
public async IAsyncEnumerable<AnthropicResult<Page<AnthropicFile>>> ListAllFilesAsync(int limit = 20, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
await foreach (var result in GetAllPagesAsync<AnthropicFile>(FilesEndpoint, limit, cancellationToken))
{
yield return result;
}
}
/// <inheritdoc/>
public async Task<AnthropicResult<AnthropicFile>> GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default)
{
var endpoint = $"{FilesEndpoint}/{fileId}";
var response = await SendRequestAsync(endpoint, cancellationToken: cancellationToken);
return await CreateResultAsync<AnthropicFile>(response);
}
/// <inheritdoc/>
public async Task<AnthropicResult<Stream>> GetFileAsync(string fileId, CancellationToken cancellationToken = default)
{
var endpoint = $"{FilesEndpoint}/{fileId}/content";
var response = await SendRequestAsync(endpoint, cancellationToken: cancellationToken);
if (response.IsSuccessStatusCode is false)
{
var content = await response.Content.ReadAsStringAsync();
var error = Deserialize<AnthropicError>(content) ?? new AnthropicError();
return AnthropicResult<Stream>.Failure(error, new AnthropicHeaders(response.Headers));
}
var stream = await response.Content.ReadAsStreamAsync();
return AnthropicResult<Stream>.Success(stream, new AnthropicHeaders(response.Headers));
}
/// <inheritdoc/>
public async Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)
{
var endpoint = $"{FilesEndpoint}/{fileId}";
var response = await SendRequestAsync(endpoint, HttpMethod.Delete, cancellationToken);
return await CreateResultAsync<AnthropicFileDeleteResponse>(response);
}
private async IAsyncEnumerable<AnthropicResult<Page<T>>> GetAllPagesAsync<T>(string endpoint, int limit = 20, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
var pagingRequest = new PagingRequest(limit: limit);
@@ -462,6 +521,17 @@ public class AnthropicApiClient : IAnthropicApiClient
return await _httpClient.PostAsync(endpoint, requestContent, cancellationToken);
}
private async Task<HttpResponseMessage> SendFileRequestAsync(string endpoint, CreateFileRequest request, CancellationToken cancellationToken = default)
{
using var multipartContent = new MultipartFormDataContent();
using var fileContent = new ByteArrayContent(request.File);
fileContent.Headers.ContentType = new MediaTypeHeaderValue(request.FileType);
multipartContent.Add(fileContent, "file", request.FileName);
return await _httpClient.PostAsync(endpoint, multipartContent, cancellationToken);
}
private string Serialize<T>(T obj) => JsonSerializer.Serialize(obj, JsonSerializationOptions.DefaultOptions);
private T? Deserialize<T>(string json) => JsonSerializer.Deserialize<T>(json, JsonSerializationOptions.DefaultOptions);
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<PackageId>AnthropicClient</PackageId>
<Version>1.0.0</Version>
<Version>1.1.0</Version>
<Authors>Stevan Freeborn</Authors>
<Description>Anthropic Client Library</Description>
<PackageProjectUrl>https://anthropicclient.stevanfreeborn.com/</PackageProjectUrl>
+17
View File
@@ -2,6 +2,23 @@
All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.
<a name="1.1.0"></a>
## [1.1.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v1.1.0) (2025-07-15)
### Features
* add missing model constants ([b859859](https://www.github.com/StevanFreeborn/anthropic-client/commit/b8598595484739027bdd83cd8cdfe122ad3cb9cf))
* add support for file source and url source ([1f83899](https://www.github.com/StevanFreeborn/anthropic-client/commit/1f83899eb88b9ee9d87d246158defd7cbde9b01e))
* implement `GetFileInfoAsync`, `GetFileAsync`, and `DeleteFileAsync` ([d1e88a5](https://www.github.com/StevanFreeborn/anthropic-client/commit/d1e88a52ace603a5c017cca3bf48953846d7b271))
* implement list all files method ([9cb8443](https://www.github.com/StevanFreeborn/anthropic-client/commit/9cb8443f94d2086192700aeb1f2dc977a86cb752))
* implement listing a page of files ([9d5c620](https://www.github.com/StevanFreeborn/anthropic-client/commit/9d5c6201674bfb0923a0b0d70530286980ebdf62))
* initial implementation of creating a file via the Files API ([e674b9a](https://www.github.com/StevanFreeborn/anthropic-client/commit/e674b9afe693143841a168c8356ef93079445db0))
### Bug Fixes
* remove unnecessary usings ([1cad19d](https://www.github.com/StevanFreeborn/anthropic-client/commit/1cad19d9c6c4418fef3c206f700ca14b7d250e26))
* use sync copy to method ([b48baff](https://www.github.com/StevanFreeborn/anthropic-client/commit/b48baffb60a8acc8b89a60e53589bc04362a9505))
<a name="1.0.0"></a>
## [1.0.0](https://www.github.com/StevanFreeborn/anthropic-client/releases/tag/v1.0.0) (2025-07-09)
@@ -111,4 +111,53 @@ public interface IAnthropicApiClient
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="AnthropicModel"/>.</returns>
Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId, CancellationToken cancellationToken = default);
/// <summary>
/// Creates a file asynchronously using the Files API.
/// </summary>
/// <param name="request">The file creation request.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="AnthropicFile"/>.</returns>
Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default);
/// <summary>
/// Lists files asynchronously, returning a single page of results.
/// </summary>
/// <param name="request">The paging request to use for listing the files.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="AnthropicFile"/>.</returns>
Task<AnthropicResult<Page<AnthropicFile>>> ListFilesAsync(PagingRequest? request = null, CancellationToken cancellationToken = default);
/// <summary>
/// Lists all files asynchronously, returning every page of results.
/// </summary>
/// <param name="limit">The maximum number of files to return in each page.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>An asynchronous enumerable that yields the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="Page{T}"/> where T is <see cref="AnthropicFile"/>.</returns>
IAsyncEnumerable<AnthropicResult<Page<AnthropicFile>>> ListAllFilesAsync(int limit = 20, CancellationToken cancellationToken = default);
/// <summary>
/// Gets a file's metadata by its ID asynchronously.
/// </summary>
/// <param name="fileId">The ID of the file to get.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="AnthropicFile"/>.</returns>
Task<AnthropicResult<AnthropicFile>> GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default);
/// <summary>
/// Gets a file's content by its ID asynchronously.
/// </summary>
/// <param name="fileId">The ID of the file to get the content for.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is a stream containing the file content.</returns>
Task<AnthropicResult<Stream>> GetFileAsync(string fileId, CancellationToken cancellationToken = default);
/// <summary>
/// Deletes a file by its ID asynchronously.
/// </summary>
/// <param name="fileId">The ID of the file to delete.</param>
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
/// <returns>A task that represents the asynchronous operation. The task result contains the response as an <see cref="AnthropicResult{T}"/> where T is <see cref="AnthropicFileDeleteResponse"/>.</returns>
Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default);
}
@@ -16,6 +16,8 @@ class SourceConverter : JsonConverter<Source>
{
SourceType.Text => JsonSerializer.Deserialize<TextSource>(root.GetRawText(), options)!,
SourceType.Content => JsonSerializer.Deserialize<CustomSource>(root.GetRawText(), options)!,
SourceType.File => JsonSerializer.Deserialize<FileSource>(root.GetRawText(), options)!,
SourceType.Url => JsonSerializer.Deserialize<UrlSource>(root.GetRawText(), options)!,
SourceType.Base64 => DeserializeBase64Source(root, options),
_ => throw new JsonException($"Unknown source type: {type}")
};
@@ -54,6 +56,18 @@ class SourceConverter : JsonConverter<Source>
return;
}
if (value is FileSource fileSource)
{
JsonSerializer.Serialize(writer, fileSource, options);
return;
}
if (value is UrlSource urlSource)
{
JsonSerializer.Serialize(writer, urlSource, options);
return;
}
JsonSerializer.Serialize(writer, value, value.GetType(), options);
}
}
@@ -0,0 +1,51 @@
using System.Text.Json.Serialization;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a file object from the Anthropic Files API.
/// </summary>
public class AnthropicFile
{
/// <summary>
/// Unique object identifier.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; init; } = string.Empty;
/// <summary>
/// Object type.
/// </summary>
[JsonPropertyName("type")]
public string Type { get; init; } = string.Empty;
/// <summary>
/// Original filename of the uploaded file.
/// </summary>
[JsonPropertyName("filename")]
public string Name { get; init; } = string.Empty;
/// <summary>
/// Date file was created.
/// </summary>
[JsonPropertyName("created_at")]
public DateTimeOffset CreatedAt { get; init; }
/// <summary>
/// Size of the file in bytes.
/// </summary>
[JsonPropertyName("size_bytes")]
public long Size { get; init; }
/// <summary>
/// MIME type of the file.
/// </summary>
[JsonPropertyName("mime_type")]
public string MimeType { get; init; } = string.Empty;
/// <summary>
/// Whether the file can be downloaded.
/// </summary>
[JsonPropertyName("downloadable")]
public bool Downloadable { get; init; }
}
@@ -0,0 +1,17 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents the response from deleting a file in the Anthropic API.
/// </summary>
public class AnthropicFileDeleteResponse
{
/// <summary>
/// Gets or sets the ID of the file that was deleted.
/// </summary>
public string Id { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the response type
/// </summary>
public string Type { get; init; } = string.Empty;
}
@@ -20,6 +20,16 @@ public static class AnthropicModels
/// </summary>
public const string Claude3OpusLatest = "claude-3-opus-latest";
/// <summary>
/// The Claude 4 Opus model.
/// </summary>
public const string ClaudeOpus420250514 = "claude-opus-4-20250514";
/// <summary>
/// The Claude 4 Opus model.
/// </summary>
public const string ClaudeOpus40 = "claude-opus-4-0";
/// <summary>
/// The Claude 3 Sonnet model.
/// </summary>
@@ -50,6 +60,26 @@ public static class AnthropicModels
/// </summary>
public const string Claude35SonnetLatest = "claude-3-5-sonnet-latest";
/// <summary>
/// The Claude 3 Sonnet model
/// </summary>
public const string Claude37Sonnet20250219 = "claude-3-7-sonnet-20250219";
/// <summary>
/// The Claude 3 Sonnet model
/// </summary>
public const string Claude37SonnetLatest = "claude-3-7-sonnet-latest";
/// <summary>
/// The Claude 4 Sonnet model.
/// </summary>
public const string ClaudeSonnet420250514 = "claude-sonnet-4-20250514";
/// <summary>
/// The Claude 4 Sonnet model.
/// </summary>
public const string ClaudeSonnet40 = "claude-sonnet-4-0";
/// <summary>
/// The Claude 3 Haiku model.
/// </summary>
@@ -0,0 +1,66 @@
using AnthropicClient.Utils;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a request to create a file via the Anthropic Files API.
/// </summary>
public class CreateFileRequest
{
/// <summary>
/// The file content as a byte array.
/// </summary>
public byte[] File { get; init; }
/// <summary>
/// The original filename of the file being uploaded.
/// </summary>
public string FileName { get; init; }
/// <summary>
/// The MIME type of the file.
/// </summary>
public string FileType { get; init; }
/// <summary>
/// Initializes a new instance of the <see cref="CreateFileRequest"/> class.
/// </summary>
/// <param name="file">The file content as a byte array.</param>
/// <param name="fileName">The original filename of the file being uploaded.</param>
/// <param name="fileType">The MIME type of the file.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="file"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="fileName"/> or <paramref name="fileType"/> is null or whitespace.</exception>
public CreateFileRequest(byte[] file, string fileName, string fileType)
{
ArgumentValidator.ThrowIfNull(file, nameof(file));
ArgumentValidator.ThrowIfNullOrWhitespace(fileName, nameof(fileName));
ArgumentValidator.ThrowIfNullOrWhitespace(fileType, nameof(fileType));
File = file;
FileName = fileName;
FileType = fileType;
}
/// <summary>
/// Initializes a new instance of the <see cref="CreateFileRequest"/> class from a stream.
/// </summary>
/// <param name="stream">The stream containing the file content.</param>
/// <param name="fileName">The original filename of the file being uploaded.</param>
/// <param name="fileType">The MIME type of the file.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stream"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="fileName"/> or <paramref name="fileType"/> is null or whitespace.</exception>
public CreateFileRequest(Stream stream, string fileName, string fileType)
{
ArgumentValidator.ThrowIfNull(stream, nameof(stream));
ArgumentValidator.ThrowIfNullOrWhitespace(fileName, nameof(fileName));
ArgumentValidator.ThrowIfNullOrWhitespace(fileType, nameof(fileType));
using var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
var fileContent = memoryStream.ToArray();
File = fileContent;
FileName = fileName;
FileType = fileType;
}
}
@@ -1,7 +1,5 @@
using System.Text.Json.Serialization;
using AnthropicClient.Utils;
namespace AnthropicClient.Models;
/// <summary>
+33
View File
@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;
namespace AnthropicClient.Models;
/// <summary>
/// Represents a file source in the Anthropic API.
/// </summary>
public class FileSource : Source
{
/// <summary>
/// Gets or sets the unique identifier for the file source.
/// </summary>
[JsonPropertyName("file_id")]
public string Id { get; init; } = string.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="FileSource"/> class.
/// </summary>
/// <returns>A new instance of <see cref="FileSource"/> with the type set to "file".</returns>
public FileSource() : base(SourceType.File)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FileSource"/> class with a specified file ID.
/// </summary>
/// <param name="id">The unique identifier for the file source.</param>
/// <returns>A new instance of <see cref="FileSource"/>.</returns>
public FileSource(string id) : base(SourceType.File)
{
Id = id;
}
}
@@ -53,4 +53,32 @@ public class ImageContent : Content
Source = new ImageSource(mediaType, data);
}
/// <summary>
/// Initializes a new instance of the <see cref="ImageContent"/> class.
/// </summary>
/// <param name="source">The source of the image.</param>
/// <returns>A new instance of the <see cref="ImageContent"/> class.</returns>
/// <exception cref="ArgumentNullException">Thrown when the source is null.</exception>
public ImageContent(Source source) : base(ContentType.Image)
{
ArgumentValidator.ThrowIfNull(source, nameof(source));
Source = source;
}
/// <summary>
/// Initializes a new instance of the <see cref="ImageContent"/> class.
/// </summary>
/// <param name="source">The source of the image.</param>
/// <param name="cacheControl">The cache control to be used for the content.</param>
/// <returns>A new instance of the <see cref="ImageContent"/> class.</returns>
/// <exception cref="ArgumentNullException">Thrown when the source or cache control is null.</exception>
public ImageContent(Source source, CacheControl cacheControl) : base(ContentType.Image, cacheControl)
{
ArgumentValidator.ThrowIfNull(source, nameof(source));
ArgumentValidator.ThrowIfNull(cacheControl, nameof(cacheControl));
Source = source;
}
}
@@ -1,7 +1,5 @@
using System.Text.Json.Serialization;
using AnthropicClient.Utils;
namespace AnthropicClient.Models;
/// <summary>
+10
View File
@@ -19,4 +19,14 @@ public static class SourceType
/// The text document source type.
/// </summary>
public const string Text = "text";
/// <summary>
/// The file document source type.
/// </summary>
public const string File = "file";
/// <summary>
/// The URL document source type.
/// </summary>
public const string Url = "url";
}
+30
View File
@@ -0,0 +1,30 @@
namespace AnthropicClient.Models;
/// <summary>
/// Represents a URL source in the Anthropic API.
/// </summary>
public class UrlSource : Source
{
/// <summary>
/// Gets or sets the URL of the source document.
/// </summary>
public string Url { get; init; } = string.Empty;
/// <summary>
/// Initializes a new instance of the <see cref="UrlSource"/> class.
/// </summary>
/// <returns>A new instance of <see cref="UrlSource"/> with the type set to "url".</returns>
public UrlSource() : base(SourceType.Url)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UrlSource"/> class with a specified URL.
/// </summary>
/// <param name="url">The URL of the source document.</param>
/// <returns>A new instance of <see cref="UrlSource"/>.</returns>
public UrlSource(string url) : base(SourceType.Url)
{
Url = url;
}
}
@@ -2,8 +2,15 @@ using AnthropicClient.Tests.Files;
namespace AnthropicClient.Tests.EndToEnd;
public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture)
public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture), IAsyncLifetime
{
private readonly List<string> _filesToDelete = [];
public Task InitializeAsync()
{
return Task.CompletedTask;
}
[Fact]
public async Task CreateMessageAsync_WhenCalled_ItShouldReturnResponse()
{
@@ -96,11 +103,41 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
text.Should().Contain("elephant");
}
[Fact]
public async Task CreateMessageAsync_WhenImageIsSentAsUrl_ItShouldReturnResponse()
{
var request = new MessageRequest(
model: AnthropicModels.Claude3Haiku,
messages: [
new(MessageRole.User, [
new ImageContent(new UrlSource("https://ftp.stevanfreeborn.com/share/anthropic-client/ant.jpg")),
new TextContent("What is in this image?")
]),
]
);
var result = await _client.CreateMessageAsync(request);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
result.Value.Content.Should().NotBeNullOrEmpty();
var text = result.Value.Content.Aggregate("", static (acc, content) =>
{
if (content is TextContent textContent)
{
acc += textContent.Text;
}
return acc;
});
text.Should().Contain("ant");
}
[Fact]
public async Task CreateMessageAsync_WhenSystemMessagesContainCacheControl_ItShouldUseCache()
{
var client = CreateClient(new HttpClient());
var storyPath = TestFileHelper.GetTestFilePath("story.txt");
var storyText = await File.ReadAllTextAsync(storyPath);
@@ -127,7 +164,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content));
request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this story?")]));
var resultTwo = await client.CreateMessageAsync(request);
var resultTwo = await _client.CreateMessageAsync(request);
resultTwo.IsSuccess.Should().BeTrue();
resultTwo.Value.Should().BeOfType<MessageResponse>();
@@ -138,8 +175,6 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
[Fact]
public async Task CreateMessageAsync_WhenMessagesContainCacheControl_ItShouldUseCache()
{
var client = CreateClient(new HttpClient());
var storyPath = TestFileHelper.GetTestFilePath("story.txt");
var storyText = await File.ReadAllTextAsync(storyPath);
@@ -153,7 +188,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
]
);
var resultOne = await client.CreateMessageAsync(request);
var resultOne = await _client.CreateMessageAsync(request);
resultOne.IsSuccess.Should().BeTrue();
resultOne.Value.Should().BeOfType<MessageResponse>();
@@ -163,7 +198,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content));
request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this story?")]));
var resultTwo = await client.CreateMessageAsync(request);
var resultTwo = await _client.CreateMessageAsync(request);
resultTwo.IsSuccess.Should().BeTrue();
resultTwo.Value.Should().BeOfType<MessageResponse>();
@@ -174,8 +209,6 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
[Fact]
public async Task CreateMessageAsync_WhenToolsContainCacheControl_ItShouldUseCache()
{
var client = CreateClient(new HttpClient());
var func = (string ticker) => ticker;
var tools = Enumerable
@@ -195,7 +228,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
tools: tools
);
var resultOne = await client.CreateMessageAsync(request);
var resultOne = await _client.CreateMessageAsync(request);
resultOne.IsSuccess.Should().BeTrue();
resultOne.Value.Should().BeOfType<MessageResponse>();
@@ -205,7 +238,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content));
request.Messages.Add(new(MessageRole.User, [new TextContent("Could you tell me the stock price for AAPL?")]));
var resultTwo = await client.CreateMessageAsync(request);
var resultTwo = await _client.CreateMessageAsync(request);
resultTwo.IsSuccess.Should().BeTrue();
resultTwo.Value.Should().BeOfType<MessageResponse>();
@@ -228,9 +261,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
]
);
var client = CreateClient(new HttpClient());
var result = await client.CreateMessageAsync(request);
var result = await _client.CreateMessageAsync(request);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<MessageResponse>();
@@ -256,8 +287,6 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
var bytes = await File.ReadAllBytesAsync(pdfPath);
var base64Data = Convert.ToBase64String(bytes);
var client = CreateClient(new HttpClient());
var request = new MessageRequest(
model: AnthropicModels.Claude35Sonnet,
messages: [
@@ -268,7 +297,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
]
);
var resultOne = await client.CreateMessageAsync(request);
var resultOne = await _client.CreateMessageAsync(request);
resultOne.IsSuccess.Should().BeTrue();
resultOne.Value.Should().BeOfType<MessageResponse>();
@@ -278,7 +307,7 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
request.Messages.Add(new(MessageRole.Assistant, resultOne.Value.Content));
request.Messages.Add(new(MessageRole.User, [new TextContent("What is the main theme of this paper?")]));
var resultTwo = await client.CreateMessageAsync(request);
var resultTwo = await _client.CreateMessageAsync(request);
resultTwo.IsSuccess.Should().BeTrue();
resultTwo.Value.Should().BeOfType<MessageResponse>();
@@ -395,6 +424,58 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
citations.OfType<ContentBlockLocationCitation>().Should().NotBeEmpty();
}
[Fact]
public async Task CreateMessageAsync_WhenCitationsAreEnabledForFileSource_ItShouldReturnCitationsInResponse()
{
var fileName = "story.txt";
var fileType = "text/plain";
var filePath = TestFileHelper.GetTestFilePath("story.txt");
var fileContent = await File.ReadAllBytesAsync(filePath);
var createFileRequest = new CreateFileRequest(fileContent, fileName, fileType);
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var createdFile = await client.CreateFileAsync(createFileRequest);
var request = new MessageRequest(
model: AnthropicModels.Claude35HaikuLatest,
messages: [
new(
MessageRole.User,
[
new DocumentContent(new FileSource(createdFile.Value.Id))
{
Title = "A Story",
Context = "This is a trustworthy document.",
Citations = new() { Enabled = true }
},
new TextContent("Can you tell me what the title of this story is?"),
]
)
]
);
var result = await client.CreateMessageAsync(request);
result.IsSuccess.Should().BeTrue();
var textContents = result.Value.Content.OfType<TextContent>();
var messageContent = textContents.Aggregate(new StringBuilder(), (sb, content) =>
{
sb.Append(content.Text);
return sb;
});
messageContent.ToString().Should().MatchRegex("The Forgotten Lighthouse");
var citations = textContents.SelectMany(static c => c.Citations is null ? [] : c.Citations);
citations.OfType<CharacterLocationCitation>().Should().NotBeEmpty();
_filesToDelete.Add(createdFile.Value.Id);
}
[Fact]
public async Task CreateMessageAsync_WhenStreamingAndCitationsAreEnabledForTextDocumentSource_ItShouldReturnCitationsInResponse()
{
@@ -516,6 +597,64 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
citations.OfType<ContentBlockLocationCitation>().Should().NotBeEmpty();
}
[Fact]
public async Task CreateMessageAsync_WhenStreamingAndCitationsAreEnabledForFileSource_ItShouldReturnCitationsInResponse()
{
var fileName = "story.txt";
var fileType = "text/plain";
var filePath = TestFileHelper.GetTestFilePath("story.txt");
var fileContent = await File.ReadAllBytesAsync(filePath);
var createFileRequest = new CreateFileRequest(fileContent, fileName, fileType);
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var createdFile = await client.CreateFileAsync(createFileRequest);
var request = new StreamMessageRequest(
model: AnthropicModels.Claude35HaikuLatest,
messages: [
new(
MessageRole.User,
[
new DocumentContent(new FileSource(createdFile.Value.Id))
{
Title = "A Story",
Context = "This is a trustworthy document.",
Citations = new() { Enabled = true }
},
new TextContent("Can you tell me what the title of this story is?"),
]
)
]
);
var result = client.CreateMessageAsync(request);
var messageCompleteEvent = await result
.Where(e => e.Type is EventType.MessageComplete)
.FirstAsync();
var textContents = messageCompleteEvent.Data
.As<MessageCompleteEventData>()
.Message
.Content
.OfType<TextContent>();
var messageContent = textContents.Aggregate(new StringBuilder(), (sb, content) =>
{
sb.Append(content.Text);
return sb;
});
messageContent.ToString().Should().MatchRegex("The Forgotten Lighthouse");
var citations = textContents.SelectMany(static c => c.Citations is null ? [] : c.Citations);
citations.OfType<CharacterLocationCitation>().Should().NotBeEmpty();
_filesToDelete.Add(createdFile.Value.Id);
}
[Fact]
public async Task CountMessageTokensAsync_WhenCalled_ItShouldReturnResponse()
{
@@ -687,4 +826,120 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
result.Value.Id.Should().Be(createResult.Value.Id);
result.Value.ProcessingStatus.Should().Be(MessageBatchStatus.Canceling);
}
[Fact]
public async Task CreateFileAsync_WhenCalled_ItShouldReturnResponse()
{
var fileName = "story.txt";
var fileType = "text/plain";
var filePath = TestFileHelper.GetTestFilePath("story.txt");
var fileContent = await File.ReadAllBytesAsync(filePath);
var request = new CreateFileRequest(fileContent, fileName, fileType);
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var result = await client.CreateFileAsync(request);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<AnthropicFile>();
result.Value.Name.Should().Be(fileName);
result.Value.MimeType.Should().Be(fileType);
_filesToDelete.Add(result.Value.Id);
}
[Fact]
public async Task ListFilesAsync_WhenCalled_ItShouldReturnPageOfFiles()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var fileBytes = await File.ReadAllBytesAsync(TestFileHelper.GetTestFilePath("story.txt"));
var createFileRequest = new CreateFileRequest(fileBytes, "story.txt", "text/plain");
var createdFile = await client.CreateFileAsync(createFileRequest);
var result = await client.ListFilesAsync();
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<Page<AnthropicFile>>();
result.Value.Data.Should().ContainSingle(f => f.Id == createdFile.Value.Id);
_filesToDelete.Add(createdFile.Value.Id);
}
[Fact]
public async Task ListAllFilesAsync_WhenCalled_ItShouldReturnAllFiles()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var fileBytes = await File.ReadAllBytesAsync(TestFileHelper.GetTestFilePath("story.txt"));
var createFileRequest = new CreateFileRequest(fileBytes, "story.txt", "text/plain");
var createdFile = await client.CreateFileAsync(createFileRequest);
var responses = await client.ListAllFilesAsync(limit: 1).ToListAsync();
responses.Should().HaveCountGreaterThan(0);
responses.Select(r => r.Value)
.SelectMany(p => p.Data)
.Should()
.ContainSingle(f => f.Id == createdFile.Value.Id);
_filesToDelete.Add(createdFile.Value.Id);
}
[Fact]
public async Task GetFileInfoAsync_WhenCalled_ItShouldReturnFile()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var fileBytes = await File.ReadAllBytesAsync(TestFileHelper.GetTestFilePath("story.txt"));
var createFileRequest = new CreateFileRequest(fileBytes, "story.txt", "text/plain");
var createdFile = await client.CreateFileAsync(createFileRequest);
var result = await client.GetFileInfoAsync(createdFile.Value.Id);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<AnthropicFile>();
result.Value.Id.Should().Be(createdFile.Value.Id);
_filesToDelete.Add(createdFile.Value.Id);
}
[Fact]
public async Task DeleteFileAsync_WhenCalled_ItShouldReturnDeleteResponse()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
var fileBytes = await File.ReadAllBytesAsync(TestFileHelper.GetTestFilePath("story.txt"));
var createFileRequest = new CreateFileRequest(fileBytes, "story.txt", "text/plain");
var createdFile = await client.CreateFileAsync(createFileRequest);
var result = await client.DeleteFileAsync(createdFile.Value.Id);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<AnthropicFileDeleteResponse>();
result.Value.Id.Should().Be(createdFile.Value.Id);
}
public async Task DisposeAsync()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14");
var client = CreateClient(httpClient);
foreach (var file in _filesToDelete)
{
var result = await client.DeleteFileAsync(file);
result.IsSuccess.Should().BeTrue();
}
}
}
@@ -1928,4 +1928,476 @@ public class AnthropicApiClientTests : IntegrationTest
result.Value.Id.Should().Be(batchId);
result.Value.Type.Should().Be("message_batch_deleted");
}
[Fact]
public async Task CreateFileAsync_WhenCalled_ItShouldReturnFile()
{
_mockHttpMessageHandler
.WhenCreateFileRequest()
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}"
);
var fileContent = new MemoryStream(Encoding.UTF8.GetBytes("Example file content"));
var request = new CreateFileRequest(fileContent, "example.txt", "text/plain");
var result = await Client.CreateFileAsync(request);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeEquivalentTo(new AnthropicFile()
{
CreatedAt = DateTimeOffset.Parse("2023-11-07T05:31:56Z"),
Downloadable = false,
Name = "example.txt",
Id = "file_013Zva2CMHLNnXjNJJKqJ2EF",
MimeType = "text/plain",
Size = 1234,
Type = "file"
});
}
[Fact]
public async Task CreateFileAsync_WhenCalledAndRequestFails_ItShouldReturnError()
{
_mockHttpMessageHandler
.WhenCreateFileRequest()
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""file: file size exceeds limit""
}
}"
);
var fileContent = new MemoryStream(Encoding.UTF8.GetBytes("Example file content"));
var request = new CreateFileRequest(fileContent, "example.txt", "text/plain");
var result = await Client.CreateFileAsync(request);
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<InvalidRequestError>();
}
[Fact]
public async Task ListFilesAsync_WhenCalled_ItShouldReturnPageOfFiles()
{
_mockHttpMessageHandler
.WhenListFilesRequest()
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""data"": [
{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}
],
""has_more"": true,
""first_id"": ""1"",
""last_id"": ""1""
}"
);
var result = await Client.ListFilesAsync();
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<Page<AnthropicFile>>();
result.Value.HasMore.Should().BeTrue();
result.Value.FirstId.Should().Be("1");
result.Value.LastId.Should().Be("1");
result.Value.Data.Should().BeEquivalentTo(new AnthropicFile[]
{
new()
{
CreatedAt = DateTimeOffset.Parse("2023-11-07T05:31:56Z"),
Downloadable = false,
Name = "example.txt",
Id = "file_013Zva2CMHLNnXjNJJKqJ2EF",
MimeType = "text/plain",
Size = 1234,
Type = "file"
}
});
}
[Fact]
public async Task ListFilesAsync_WhenCalledAndRequestFails_ItShouldReturnError()
{
_mockHttpMessageHandler
.WhenListFilesRequest()
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""files: file not found""
}
}"
);
var result = await Client.ListFilesAsync();
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<InvalidRequestError>();
}
[Fact]
public async Task ListFilesAsync_WhenCalledWithPagingRequest_ItShouldReturnPageOfFiles()
{
var pagingRequest = new PagingRequest(afterId: "next_id", limit: 10);
_mockHttpMessageHandler
.WhenListFilesRequest()
.WithQueryString(new Dictionary<string, string>
{
{ "after_id", pagingRequest.AfterId },
{ "limit", pagingRequest.Limit.ToString() },
})
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""data"": [
{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}
],
""has_more"": true,
""first_id"": ""1"",
""last_id"": ""1""
}"
);
var result = await Client.ListFilesAsync(pagingRequest);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<Page<AnthropicFile>>();
result.Value.HasMore.Should().BeTrue();
result.Value.FirstId.Should().Be("1");
result.Value.LastId.Should().Be("1");
result.Value.Data.Should().BeEquivalentTo(new AnthropicFile[]
{
new()
{
CreatedAt = DateTimeOffset.Parse("2023-11-07T05:31:56Z"),
Downloadable = false,
Name = "example.txt",
Id = "file_013Zva2CMHLNnXjNJJKqJ2EF",
MimeType = "text/plain",
Size = 1234,
Type = "file"
}
});
}
[Fact]
public async Task ListAllFilesAsync_WhenCalled_ItShouldReturnAllFiles()
{
_mockHttpMessageHandler
.WhenListFilesRequest()
.WithExactQueryString(new Dictionary<string, string>()
{
{ "limit", "20" },
})
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""data"": [
{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}
],
""has_more"": true,
""first_id"": ""1"",
""last_id"": ""1""
}"
);
_mockHttpMessageHandler
.WhenListFilesRequest()
.WithExactQueryString(new Dictionary<string, string>()
{
{ "after_id", "1" },
{ "limit", "20" },
})
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""data"": [
{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}
],
""has_more"": false,
""first_id"": ""2"",
""last_id"": ""2""
}"
);
var pageResponses = Client.ListAllFilesAsync();
var collectedPages = new List<Page<AnthropicFile>>();
await foreach (var response in pageResponses)
{
response.IsSuccess.Should().BeTrue();
response.Value.Should().BeOfType<Page<AnthropicFile>>();
collectedPages.Add(response.Value);
}
var expectedFile = new AnthropicFile()
{
CreatedAt = DateTimeOffset.Parse("2023-11-07T05:31:56Z"),
Downloadable = false,
Name = "example.txt",
Id = "file_013Zva2CMHLNnXjNJJKqJ2EF",
MimeType = "text/plain",
Size = 1234,
Type = "file"
};
collectedPages.Should().HaveCount(2);
collectedPages.Should().BeEquivalentTo(new List<Page<AnthropicFile>>()
{
new()
{
Data = [expectedFile],
FirstId = "1",
LastId = "1",
HasMore = true
},
new()
{
Data = [expectedFile],
FirstId = "2",
LastId = "2",
HasMore = false
}
});
}
[Fact]
public async Task GetFileInfoAsync_WhenCalled_ItShouldReturnFile()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenGetFileRequest(fileId)
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""created_at"": ""2023-11-07T05:31:56Z"",
""downloadable"": false,
""filename"": ""example.txt"",
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""mime_type"": ""text/plain"",
""size_bytes"": 1234,
""type"": ""file""
}"
);
var result = await Client.GetFileInfoAsync(fileId);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeEquivalentTo(new AnthropicFile()
{
CreatedAt = DateTimeOffset.Parse("2023-11-07T05:31:56Z"),
Downloadable = false,
Name = "example.txt",
Id = "file_013Zva2CMHLNnXjNJJKqJ2EF",
MimeType = "text/plain",
Size = 1234,
Type = "file"
});
}
[Fact]
public async Task GetFileInfoAsync_WhenCalledAndRequestFails_ItShouldReturnError()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenGetFileRequest(fileId)
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""file: file not found""
}
}"
);
var result = await Client.GetFileInfoAsync(fileId);
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<InvalidRequestError>();
}
[Fact]
public async Task GetFileAsync_WhenCalled_ItShouldReturnFileContent()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
var fileContent = new MemoryStream(Encoding.UTF8.GetBytes("Example file content"));
_mockHttpMessageHandler
.WhenGetFileContentRequest(fileId)
.Respond(
HttpStatusCode.OK,
"application/octet-stream",
fileContent
);
var result = await Client.GetFileAsync(fileId);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeAssignableTo<Stream>();
using var streamReader = new StreamReader(result.Value);
var content = await streamReader.ReadToEndAsync();
content.Should().Be("Example file content");
}
[Fact]
public async Task GetFileAsync_WhenCalledAndRequestFails_ItShouldReturnError()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenGetFileContentRequest(fileId)
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""file: file not found""
}
}"
);
var result = await Client.GetFileAsync(fileId);
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<InvalidRequestError>();
}
[Fact]
public async Task GetFileAsync_WhenCalledAndCanNotDeserializeResponse_ItShouldReturnError()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenGetFileContentRequest(fileId)
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"null"
);
var result = await Client.GetFileAsync(fileId);
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<ApiError>();
}
[Fact]
public async Task DeleteFileAsync_WhenCalled_ItShouldReturnDeletionResponse()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenDeleteFileRequest(fileId)
.Respond(
HttpStatusCode.OK,
"application/json",
@"{
""id"": ""file_013Zva2CMHLNnXjNJJKqJ2EF"",
""type"": ""file_deleted""
}"
);
var result = await Client.DeleteFileAsync(fileId);
result.IsSuccess.Should().BeTrue();
result.Value.Should().BeOfType<AnthropicFileDeleteResponse>();
result.Value.Id.Should().Be(fileId);
result.Value.Type.Should().Be("file_deleted");
}
[Fact]
public async Task DeleteFileAsync_WhenCalledAndRequestFails_ItShouldReturnError()
{
var fileId = "file_013Zva2CMHLNnXjNJJKqJ2EF";
_mockHttpMessageHandler
.WhenDeleteFileRequest(fileId)
.Respond(
HttpStatusCode.BadRequest,
"application/json",
@"{
""type"": ""error"",
""error"": {
""type"": ""invalid_request_error"",
""message"": ""file: file not found""
}
}"
);
var result = await Client.DeleteFileAsync(fileId);
result.IsSuccess.Should().BeFalse();
result.Error.Should().BeOfType<AnthropicError>();
result.Error.Error.Should().BeOfType<InvalidRequestError>();
}
}
@@ -20,6 +20,7 @@ public static class MockHttpMessageHandlerExtensions
private static readonly string CountTokensEndpoint = $"{BaseUrl}/messages/count_tokens";
private static readonly string MessageBatchesEndpoint = $"{BaseUrl}/messages/batches";
private static readonly string ModelsEndpoint = $"{BaseUrl}/models";
private static readonly string FilesEndpoint = $"{BaseUrl}/files";
private static MockedRequest SetupBaseRequest(
this MockHttpMessageHandler mockHttpMessageHandler,
@@ -103,4 +104,34 @@ public static class MockHttpMessageHandlerExtensions
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Delete, $"{MessageBatchesEndpoint}/{batchId}");
}
public static MockedRequest WhenCreateFileRequest(this MockHttpMessageHandler mockHttpMessageHandler)
{
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Post, FilesEndpoint);
}
public static MockedRequest WhenListFilesRequest(this MockHttpMessageHandler mockHttpMessageHandler)
{
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Get, FilesEndpoint);
}
public static MockedRequest WhenGetFileRequest(this MockHttpMessageHandler mockHttpMessageHandler, string fileId)
{
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Get, $"{FilesEndpoint}/{fileId}");
}
public static MockedRequest WhenGetFileContentRequest(this MockHttpMessageHandler mockHttpMessageHandler, string fileId)
{
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Get, $"{FilesEndpoint}/{fileId}/content");
}
public static MockedRequest WhenDeleteFileRequest(this MockHttpMessageHandler mockHttpMessageHandler, string fileId)
{
return mockHttpMessageHandler
.SetupBaseRequest(HttpMethod.Delete, $"{FilesEndpoint}/{fileId}");
}
}
@@ -0,0 +1,58 @@
namespace AnthropicClient.Tests.Unit.Models;
public class AnthropicFileDeleteResponseTests : SerializationTest
{
private readonly string _testJson = @"{
""id"": ""file-12345"",
""type"": ""file_deleted""
}";
[Fact]
public void Constructor_WhenCalled_ItShouldInitializeProperties()
{
var response = new AnthropicFileDeleteResponse();
response.Id.Should().BeEmpty();
response.Type.Should().BeEmpty();
}
[Fact]
public void Constructor_WhenCalledWithValues_ItShouldInitializePropertiesWithValues()
{
var id = "file-12345";
var type = "file_deleted";
var response = new AnthropicFileDeleteResponse
{
Id = id,
Type = type
};
response.Id.Should().Be(id);
response.Type.Should().Be(type);
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldMatchExpectedJson()
{
var response = new AnthropicFileDeleteResponse
{
Id = "file-12345",
Type = "file_deleted"
};
var json = JsonSerializer.Serialize(response, JsonSerializationOptions.DefaultOptions);
JsonAssert.Equal(_testJson, json);
}
[Fact]
public void JsonDeserialization_WhenDeserialized_ItShouldMatchExpectedObject()
{
var response = JsonSerializer.Deserialize<AnthropicFileDeleteResponse>(_testJson, JsonSerializationOptions.DefaultOptions);
response.Should().NotBeNull();
response.Id.Should().Be("file-12345");
response.Type.Should().Be("file_deleted");
}
}
@@ -0,0 +1,95 @@
namespace AnthropicClient.Tests.Unit.Models;
public class AnthropicFileTests : SerializationTest
{
private readonly string _testJson = @"{
""id"": ""file-123"",
""type"": ""file"",
""filename"": ""test.txt"",
""created_at"": ""2023-10-01T00:00:00Z"",
""size_bytes"": 1024,
""mime_type"": ""text/plain"",
""downloadable"": true
}";
[Fact]
public void Constructor_WhenCalled_ItShouldInitializeProperties()
{
var result = new AnthropicFile();
result.Id.Should().BeEmpty();
result.Type.Should().BeEmpty();
result.Name.Should().BeEmpty();
result.CreatedAt.Should().Be(DateTimeOffset.MinValue);
result.Size.Should().Be(0);
result.MimeType.Should().BeEmpty();
result.Downloadable.Should().BeFalse();
}
[Fact]
public void Constructor_WhenCalledWithValues_ItShouldInitializeProperties()
{
var file = new AnthropicFile
{
Id = "file-123",
Type = "file",
Name = "test.txt",
CreatedAt = new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero),
Size = 1024,
MimeType = "text/plain",
Downloadable = true
};
file.Id.Should().Be("file-123");
file.Type.Should().Be("file");
file.Name.Should().Be("test.txt");
file.CreatedAt.Should().Be(new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero));
file.Size.Should().Be(1024);
file.MimeType.Should().Be("text/plain");
file.Downloadable.Should().BeTrue();
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{
var file = new AnthropicFile
{
Id = "file-123",
Type = "file",
Name = "test.txt",
CreatedAt = new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero),
Size = 1024,
MimeType = "text/plain",
Downloadable = true
};
var json = Serialize(file);
var expectedJson = @"{
""id"": ""file-123"",
""type"": ""file"",
""filename"": ""test.txt"",
""created_at"": ""2023-10-01T00:00:00+00:00"",
""size_bytes"": 1024,
""mime_type"": ""text/plain"",
""downloadable"": true
}";
JsonAssert.Equal(expectedJson, json, true);
}
[Fact]
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
{
var file = Deserialize<AnthropicFile>(_testJson);
file.Should().NotBeNull();
file!.Id.Should().Be("file-123");
file.Type.Should().Be("file");
file.Name.Should().Be("test.txt");
file.CreatedAt.Should().Be(new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero));
file.Size.Should().Be(1024);
file.MimeType.Should().Be("text/plain");
file.Downloadable.Should().BeTrue();
}
}
@@ -131,4 +131,64 @@ public class AnthropicModelsTests
actual.Should().Be(expected);
}
[Fact]
public void Claude37Sonnet20250219_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-3-7-sonnet-20250219";
var actual = AnthropicModels.Claude37Sonnet20250219;
actual.Should().Be(expected);
}
[Fact]
public void Claude37SonnetLatest_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-3-7-sonnet-latest";
var actual = AnthropicModels.Claude37SonnetLatest;
actual.Should().Be(expected);
}
[Fact]
public void ClaudeSonnet420250514_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-sonnet-4-20250514";
var actual = AnthropicModels.ClaudeSonnet420250514;
actual.Should().Be(expected);
}
[Fact]
public void ClaudeSonnet40_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-sonnet-4-0";
var actual = AnthropicModels.ClaudeSonnet40;
actual.Should().Be(expected);
}
[Fact]
public void ClaudeOpus420250514_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-opus-4-20250514";
var actual = AnthropicModels.ClaudeOpus420250514;
actual.Should().Be(expected);
}
[Fact]
public void ClaudeOpus40_WhenCalled_ItShouldReturnExpectedValue()
{
var expected = "claude-opus-4-0";
var actual = AnthropicModels.ClaudeOpus40;
actual.Should().Be(expected);
}
}
@@ -0,0 +1,106 @@
namespace AnthropicClient.Tests.Unit.Models;
public class CreateFileRequestTests
{
[Fact]
public void Constructor_WhenCalledWithBytes_ItShouldInitializeProperties()
{
var fileContent = new byte[] { 1, 2, 3 };
var fileName = "test.txt";
var fileType = "text/plain";
var request = new CreateFileRequest(fileContent, fileName, fileType);
request.File.Should().BeSameAs(fileContent);
request.FileName.Should().Be(fileName);
request.FileType.Should().Be(fileType);
}
[Fact]
public void Constructor_WhenCalledWithStream_ItShouldInitializeProperties()
{
using var stream = new MemoryStream([1, 2, 3]);
var fileName = "test.txt";
var fileType = "text/plain";
var request = new CreateFileRequest(stream, fileName, fileType);
request.File.Should().BeEquivalentTo(new byte[] { 1, 2, 3 });
request.FileName.Should().Be(fileName);
request.FileType.Should().Be(fileType);
}
[Fact]
public void Constructor_WhenCalledWithNullBytes_ItShouldThrowArgumentNullException()
{
var act = () => new CreateFileRequest((byte[])null!, "test.txt", "text/plain");
act.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCalledWithBytesAndNullFileName_ItShouldThrowArgumentException()
{
var act = () => new CreateFileRequest([1, 2, 3], null!, "text/plain");
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithBytesAndFileNameIsEmpty_ItShouldThrowArgumentException()
{
var act = () => new CreateFileRequest([1, 2, 3], string.Empty, "text/plain");
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithBytesAndNullFileType_ItShouldThrowArgumentException()
{
var act = () => new CreateFileRequest([1, 2, 3], "test.txt", null!);
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithBytesAndFileTypeIsEmpty_ItShouldThrowArgumentException()
{
var act = () => new CreateFileRequest([1, 2, 3], "test.txt", string.Empty);
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithNullStream_ItShouldThrowArgumentNullException()
{
var act = () => new CreateFileRequest((Stream)null!, "test.txt", "text/plain");
act.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCalledWithStreamAndNullFileName_ItShouldThrowArgumentException()
{
using var stream = new MemoryStream([1, 2, 3]);
var act = () => new CreateFileRequest(stream, null!, "text/plain");
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithStreamAndFileNameIsEmpty_ItShouldThrowArgumentException()
{
using var stream = new MemoryStream([1, 2, 3]);
var act = () => new CreateFileRequest(stream, string.Empty, "text/plain");
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithStreamAndNullFileType_ItShouldThrowArgumentException()
{
using var stream = new MemoryStream([1, 2, 3]);
var act = () => new CreateFileRequest(stream, "test.txt", null!);
act.Should().Throw<ArgumentException>();
}
[Fact]
public void Constructor_WhenCalledWithStreamAndFileTypeIsEmpty_ItShouldThrowArgumentException()
{
using var stream = new MemoryStream([1, 2, 3]);
var act = () => new CreateFileRequest(stream, "test.txt", string.Empty);
act.Should().Throw<ArgumentException>();
}
}
@@ -0,0 +1,63 @@
namespace AnthropicClient.Tests.Unit.Models;
public class FileSourceTests : SerializationTest
{
private readonly string _testJson = @"{
""file_id"": ""id"",
""type"": ""file""
}";
[Fact]
public void Constructor_WhenCalled_ItShouldInitializeProperties()
{
var result = new FileSource();
result.Type.Should().Be("file");
result.Id.Should().BeEmpty();
}
[Fact]
public void Constructor_WhenCalledWithValues_ItShouldInitializeProperties()
{
var id = "id";
var type = "type";
var result = new FileSource()
{
Id = id,
Type = type,
};
result.Id.Should().Be(id);
result.Type.Should().Be(type);
}
[Fact]
public void Constructor_WhenCalledWithId_ItShouldInitializeProperties()
{
var id = "id";
var result = new FileSource(id);
result.Id.Should().Be(id);
result.Type.Should().Be("file");
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{
var source = new FileSource() { Id = "id" };
var result = Serialize<Source>(source);
JsonAssert.Equal(_testJson, result);
}
[Fact]
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
{
var result = Deserialize<Source>(_testJson);
result.Should().BeEquivalentTo(new FileSource() { Id = "id" });
}
}
@@ -77,7 +77,7 @@ public class ImageContentTests : SerializationTest
}
[Fact]
public void Constructor_WhenCalledWithCacheControlAndMediatTypeIsNull_ItShouldThrowArgumentNullException()
public void Constructor_WhenCalledWithCacheControlAndMediaTypeIsNull_ItShouldThrowArgumentNullException()
{
var expectedData = "data";
var cacheControl = new EphemeralCacheControl();
@@ -98,6 +98,49 @@ public class ImageContentTests : SerializationTest
action.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCalledWithSource_ItShouldInitializeSource()
{
var source = new ImageSource("image/png", "data");
var result = new ImageContent(source);
result.Source.Should().BeSameAs(source);
}
[Fact]
public void Constructor_WhenCalledWithSourceAndCacheControl_ItShouldInitializeSourceAndCacheControl()
{
var source = new ImageSource("image/png", "data");
var cacheControl = new EphemeralCacheControl();
var result = new ImageContent(source, cacheControl);
result.Source.Should().BeSameAs(source);
result.CacheControl.Should().BeSameAs(cacheControl);
}
[Fact]
public void Constructor_WhenSourceIsNull_ItShouldThrowArgumentNullException()
{
Source? source = null;
var action = () => new ImageContent(source!);
action.Should().Throw<ArgumentNullException>();
}
[Fact]
public void Constructor_WhenCacheControlIsNull_ItShouldThrowNullException()
{
var source = new ImageSource("image/png", "data");
CacheControl? cacheControl = null;
var action = () => new ImageContent(source, cacheControl!);
action.Should().Throw<ArgumentNullException>();
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{
@@ -19,4 +19,10 @@ public class SourceTypeTests
{
SourceType.Text.Should().Be("text");
}
[Fact]
public void File_WhenCalled_ItShouldReturnCorrectValue()
{
SourceType.File.Should().Be("file");
}
}
@@ -0,0 +1,64 @@
namespace AnthropicClient.Tests.Unit.Models;
public class UrlSourceTests : SerializationTest
{
private readonly string _testJson = @"{
""type"": ""url"",
""url"": ""https://example.com/document.pdf""
}";
[Fact]
public void Constructor_WhenCalled_ItShouldInitializeProperties()
{
var result = new UrlSource();
result.Url.Should().BeEmpty();
result.Type.Should().Be("url");
}
[Fact]
public void Constructor_WhenCalledWithValues_ItShouldInitializeProperties()
{
var url = "https://example.com/document.pdf";
var type = "type";
var result = new UrlSource()
{
Url = url,
Type = type,
};
result.Url.Should().Be(url);
result.Type.Should().Be(type);
}
[Fact]
public void Constructor_WhenCalledWithUrl_ItShouldInitializeProperties()
{
var url = "https://example.com/document.pdf";
var result = new UrlSource(url);
result.Url.Should().Be(url);
result.Type.Should().Be("url");
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{
var url = "https://example.com/document.pdf";
var source = new UrlSource(url);
var result = Serialize<Source>(source);
JsonAssert.Equal(_testJson, result);
}
[Fact]
public void JsonDeserialization_WhenDeserialized_ItShouldMatchExpectedObject()
{
var result = Deserialize<Source>(_testJson);
result.Should().BeEquivalentTo(new UrlSource("https://example.com/document.pdf"));
}
}