Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a63dec2b9 | ||
|
|
84ce38a586 | ||
|
|
5d5b60486f | ||
|
|
654e2b1a6a |
No files matched your search
@@ -201,150 +201,6 @@ 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, you’ll 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.
|
||||
|
||||
@@ -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/#L38"><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/#L37"><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/#L304"><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/#L303"><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/#L352"><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/#L351"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Counts the tokens in a message asynchronously.</p>
|
||||
@@ -289,53 +289,11 @@ 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<AnthropicResult<AnthropicFile>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>></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<T></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/#L57"><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/#L56"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
|
||||
@@ -377,7 +335,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/#L80"><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/#L79"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
|
||||
@@ -419,7 +377,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/#L272"><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/#L271"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Creates a batch of messages asynchronously.</p>
|
||||
@@ -457,53 +415,11 @@ 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<AnthropicResult<AnthropicFileDeleteResponse>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>>></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<T></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/#L312"><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/#L311"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Deletes a message batch asynchronously.</p>
|
||||
@@ -541,95 +457,11 @@ 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<AnthropicResult<Stream>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a>>></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<T></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<AnthropicResult<AnthropicFile>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>></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<T></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/#L279"><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/#L278"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Gets a message batch asynchronously.</p>
|
||||
@@ -671,7 +503,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/#L320"><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/#L319"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Gets the results of a message batch asynchronously.</p>
|
||||
@@ -713,7 +545,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/#L377"><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/#L376"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Gets a model by its ID asynchronously.</p>
|
||||
@@ -751,53 +583,11 @@ 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<AnthropicResult<Page<AnthropicFile>>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>>></dt>
|
||||
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></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/#L295"><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/#L294"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Lists all message batches asynchronously.</p>
|
||||
@@ -839,7 +629,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/#L368"><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/#L367"><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>
|
||||
@@ -877,53 +667,11 @@ 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<AnthropicResult<Page<AnthropicFile>>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>>></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<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></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/#L286"><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/#L285"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Lists the message batches asynchronously.</p>
|
||||
@@ -965,7 +713,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/#L359"><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/#L358"><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,48 +205,6 @@ 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<AnthropicResult<AnthropicFile>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>></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<T></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)">
|
||||
@@ -373,48 +331,6 @@ 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<AnthropicResult<AnthropicFileDeleteResponse>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFileDeleteResponse.html">AnthropicFileDeleteResponse</a>>></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<T></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)">
|
||||
@@ -457,90 +373,6 @@ 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<AnthropicResult<Stream>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a>>></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<T></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<AnthropicResult<AnthropicFile>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>></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<T></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)">
|
||||
@@ -667,48 +499,6 @@ 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<AnthropicResult<Page<AnthropicFile>>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>>></dt>
|
||||
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></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)">
|
||||
@@ -793,48 +583,6 @@ 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<AnthropicResult<Page<AnthropicFile>>> 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><<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a><<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a><<a class="xref" href="AnthropicClient.Models.AnthropicFile.html">AnthropicFile</a>>>></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<T></a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page<T></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)">
|
||||
|
||||
@@ -1,412 +0,0 @@
|
||||
<!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&value=---%0Auid%3A%20AnthropicClient.Models.AnthropicFile%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%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 "{query}"">
|
||||
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||
<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("created_at")]
|
||||
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("downloadable")]
|
||||
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("id")]
|
||||
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("mime_type")]
|
||||
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("filename")]
|
||||
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("size_bytes")]
|
||||
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("type")]
|
||||
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>
|
||||
@@ -1,245 +0,0 @@
|
||||
<!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&value=---%0Auid%3A%20AnthropicClient.Models.AnthropicFileDeleteResponse%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%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 "{query}"">
|
||||
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||
<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/#L96"><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/#L66"><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/#L101"><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/#L71"><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/#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/#L36"><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/#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/#L41"><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/#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/#L46"><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/#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/#L51"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>The Claude 3.5 Sonnet model.</p>
|
||||
@@ -340,71 +340,9 @@ 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 = "claude-3-7-sonnet-20250219"</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 = "claude-3-7-sonnet-latest"</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/#L86"><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 Haiku model.</p>
|
||||
@@ -435,7 +373,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/#L91"><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 Haiku model.</p>
|
||||
@@ -559,7 +497,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/#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/#L26"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
|
||||
@@ -590,7 +528,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/#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/#L31"><i class="bi bi-code-slash"></i></a>
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>The Claude 3 Sonnet model.</p>
|
||||
@@ -619,130 +557,6 @@ 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 = "claude-opus-4-0"</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 = "claude-opus-4-20250514"</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 = "claude-sonnet-4-0"</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 = "claude-sonnet-4-20250514"</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">
|
||||
|
||||
@@ -1,377 +0,0 @@
|
||||
<!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&value=---%0Auid%3A%20AnthropicClient.Models.CreateFileRequest%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%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 "{query}"">
|
||||
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||
<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/#L8"><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/#L10"><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/#L23"><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/#L25"><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/#L8" class="edit-link">Edit this page</a>
|
||||
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/DocumentSource.cs/#L10" class="edit-link">Edit this page</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -1,282 +0,0 @@
|
||||
<!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&value=---%0Auid%3A%20AnthropicClient.Models.FileSource%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%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 "{query}"">
|
||||
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||
<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("file_id")]
|
||||
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,87 +160,6 @@ 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/#L8"><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/#L10"><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/#L23"><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/#L25"><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/#L8" class="edit-link">Edit this page</a>
|
||||
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/Models/ImageSource.cs/#L10" class="edit-link">Edit this page</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -122,9 +122,7 @@ 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,37 +216,6 @@ 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 = "file"</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>
|
||||
@@ -278,37 +247,6 @@ 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 = "url"</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">
|
||||
|
||||
@@ -1,281 +0,0 @@
|
||||
<!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&value=---%0Auid%3A%20AnthropicClient.Models.UrlSource%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%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 "{query}"">
|
||||
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
||||
<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>
|
||||
@@ -102,16 +102,6 @@ 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">
|
||||
@@ -247,11 +237,6 @@ 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">
|
||||
@@ -307,11 +292,6 @@ 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">
|
||||
@@ -577,11 +557,6 @@ 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">
|
||||
|
||||
@@ -36,12 +36,6 @@
|
||||
<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>
|
||||
@@ -123,9 +117,6 @@
|
||||
<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>
|
||||
@@ -159,9 +150,6 @@
|
||||
<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>
|
||||
@@ -324,9 +312,6 @@
|
||||
<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
@@ -1,2 +1,2 @@
|
||||
|
||||
{"items":[{"name":"AnthropicClient","href":"AnthropicClient.html","topicHref":"AnthropicClient.html","topicUid":"AnthropicClient","type":"Namespace","items":[{"name":"AnthropicApiClient","href":"AnthropicClient.AnthropicApiClient.html","topicHref":"AnthropicClient.AnthropicApiClient.html","topicUid":"AnthropicClient.AnthropicApiClient","type":"Class"},{"name":"IAnthropicApiClient","href":"AnthropicClient.IAnthropicApiClient.html","topicHref":"AnthropicClient.IAnthropicApiClient.html","topicUid":"AnthropicClient.IAnthropicApiClient","type":"Interface"}]},{"name":"AnthropicClient.Models","href":"AnthropicClient.Models.html","topicHref":"AnthropicClient.Models.html","topicUid":"AnthropicClient.Models","type":"Namespace","items":[{"name":"AnthropicError","href":"AnthropicClient.Models.AnthropicError.html","topicHref":"AnthropicClient.Models.AnthropicError.html","topicUid":"AnthropicClient.Models.AnthropicError","type":"Class"},{"name":"AnthropicEvent","href":"AnthropicClient.Models.AnthropicEvent.html","topicHref":"AnthropicClient.Models.AnthropicEvent.html","topicUid":"AnthropicClient.Models.AnthropicEvent","type":"Class"},{"name":"AnthropicFile","href":"AnthropicClient.Models.AnthropicFile.html","topicHref":"AnthropicClient.Models.AnthropicFile.html","topicUid":"AnthropicClient.Models.AnthropicFile","type":"Class"},{"name":"AnthropicFileDeleteResponse","href":"AnthropicClient.Models.AnthropicFileDeleteResponse.html","topicHref":"AnthropicClient.Models.AnthropicFileDeleteResponse.html","topicUid":"AnthropicClient.Models.AnthropicFileDeleteResponse","type":"Class"},{"name":"AnthropicFunction","href":"AnthropicClient.Models.AnthropicFunction.html","topicHref":"AnthropicClient.Models.AnthropicFunction.html","topicUid":"AnthropicClient.Models.AnthropicFunction","type":"Class"},{"name":"AnthropicHeaders","href":"AnthropicClient.Models.AnthropicHeaders.html","topicHref":"AnthropicClient.Models.AnthropicHeaders.html","topicUid":"AnthropicClient.Models.AnthropicHeaders","type":"Class"},{"name":"AnthropicModel","href":"AnthropicClient.Models.AnthropicModel.html","topicHref":"AnthropicClient.Models.AnthropicModel.html","topicUid":"AnthropicClient.Models.AnthropicModel","type":"Class"},{"name":"AnthropicModels","href":"AnthropicClient.Models.AnthropicModels.html","topicHref":"AnthropicClient.Models.AnthropicModels.html","topicUid":"AnthropicClient.Models.AnthropicModels","type":"Class"},{"name":"AnyToolChoice","href":"AnthropicClient.Models.AnyToolChoice.html","topicHref":"AnthropicClient.Models.AnyToolChoice.html","topicUid":"AnthropicClient.Models.AnyToolChoice","type":"Class"},{"name":"ApiError","href":"AnthropicClient.Models.ApiError.html","topicHref":"AnthropicClient.Models.ApiError.html","topicUid":"AnthropicClient.Models.ApiError","type":"Class"},{"name":"AuthenticationError","href":"AnthropicClient.Models.AuthenticationError.html","topicHref":"AnthropicClient.Models.AuthenticationError.html","topicUid":"AnthropicClient.Models.AuthenticationError","type":"Class"},{"name":"AutoToolChoice","href":"AnthropicClient.Models.AutoToolChoice.html","topicHref":"AnthropicClient.Models.AutoToolChoice.html","topicUid":"AnthropicClient.Models.AutoToolChoice","type":"Class"},{"name":"Base64Source","href":"AnthropicClient.Models.Base64Source.html","topicHref":"AnthropicClient.Models.Base64Source.html","topicUid":"AnthropicClient.Models.Base64Source","type":"Class"},{"name":"BaseMessageRequest","href":"AnthropicClient.Models.BaseMessageRequest.html","topicHref":"AnthropicClient.Models.BaseMessageRequest.html","topicUid":"AnthropicClient.Models.BaseMessageRequest","type":"Class"},{"name":"CacheControl","href":"AnthropicClient.Models.CacheControl.html","topicHref":"AnthropicClient.Models.CacheControl.html","topicUid":"AnthropicClient.Models.CacheControl","type":"Class"},{"name":"CacheControlType","href":"AnthropicClient.Models.CacheControlType.html","topicHref":"AnthropicClient.Models.CacheControlType.html","topicUid":"AnthropicClient.Models.CacheControlType","type":"Class"},{"name":"CanceledMessageBatchResult","href":"AnthropicClient.Models.CanceledMessageBatchResult.html","topicHref":"AnthropicClient.Models.CanceledMessageBatchResult.html","topicUid":"AnthropicClient.Models.CanceledMessageBatchResult","type":"Class"},{"name":"CharacterLocationCitation","href":"AnthropicClient.Models.CharacterLocationCitation.html","topicHref":"AnthropicClient.Models.CharacterLocationCitation.html","topicUid":"AnthropicClient.Models.CharacterLocationCitation","type":"Class"},{"name":"Citation","href":"AnthropicClient.Models.Citation.html","topicHref":"AnthropicClient.Models.Citation.html","topicUid":"AnthropicClient.Models.Citation","type":"Class"},{"name":"CitationDelta","href":"AnthropicClient.Models.CitationDelta.html","topicHref":"AnthropicClient.Models.CitationDelta.html","topicUid":"AnthropicClient.Models.CitationDelta","type":"Class"},{"name":"CitationOption","href":"AnthropicClient.Models.CitationOption.html","topicHref":"AnthropicClient.MLine truncated
|
||||
{"items":[{"name":"AnthropicClient","href":"AnthropicClient.html","topicHref":"AnthropicClient.html","topicUid":"AnthropicClient","type":"Namespace","items":[{"name":"AnthropicApiClient","href":"AnthropicClient.AnthropicApiClient.html","topicHref":"AnthropicClient.AnthropicApiClient.html","topicUid":"AnthropicClient.AnthropicApiClient","type":"Class"},{"name":"IAnthropicApiClient","href":"AnthropicClient.IAnthropicApiClient.html","topicHref":"AnthropicClient.IAnthropicApiClient.html","topicUid":"AnthropicClient.IAnthropicApiClient","type":"Interface"}]},{"name":"AnthropicClient.Models","href":"AnthropicClient.Models.html","topicHref":"AnthropicClient.Models.html","topicUid":"AnthropicClient.Models","type":"Namespace","items":[{"name":"AnthropicError","href":"AnthropicClient.Models.AnthropicError.html","topicHref":"AnthropicClient.Models.AnthropicError.html","topicUid":"AnthropicClient.Models.AnthropicError","type":"Class"},{"name":"AnthropicEvent","href":"AnthropicClient.Models.AnthropicEvent.html","topicHref":"AnthropicClient.Models.AnthropicEvent.html","topicUid":"AnthropicClient.Models.AnthropicEvent","type":"Class"},{"name":"AnthropicFunction","href":"AnthropicClient.Models.AnthropicFunction.html","topicHref":"AnthropicClient.Models.AnthropicFunction.html","topicUid":"AnthropicClient.Models.AnthropicFunction","type":"Class"},{"name":"AnthropicHeaders","href":"AnthropicClient.Models.AnthropicHeaders.html","topicHref":"AnthropicClient.Models.AnthropicHeaders.html","topicUid":"AnthropicClient.Models.AnthropicHeaders","type":"Class"},{"name":"AnthropicModel","href":"AnthropicClient.Models.AnthropicModel.html","topicHref":"AnthropicClient.Models.AnthropicModel.html","topicUid":"AnthropicClient.Models.AnthropicModel","type":"Class"},{"name":"AnthropicModels","href":"AnthropicClient.Models.AnthropicModels.html","topicHref":"AnthropicClient.Models.AnthropicModels.html","topicUid":"AnthropicClient.Models.AnthropicModels","type":"Class"},{"name":"AnyToolChoice","href":"AnthropicClient.Models.AnyToolChoice.html","topicHref":"AnthropicClient.Models.AnyToolChoice.html","topicUid":"AnthropicClient.Models.AnyToolChoice","type":"Class"},{"name":"ApiError","href":"AnthropicClient.Models.ApiError.html","topicHref":"AnthropicClient.Models.ApiError.html","topicUid":"AnthropicClient.Models.ApiError","type":"Class"},{"name":"AuthenticationError","href":"AnthropicClient.Models.AuthenticationError.html","topicHref":"AnthropicClient.Models.AuthenticationError.html","topicUid":"AnthropicClient.Models.AuthenticationError","type":"Class"},{"name":"AutoToolChoice","href":"AnthropicClient.Models.AutoToolChoice.html","topicHref":"AnthropicClient.Models.AutoToolChoice.html","topicUid":"AnthropicClient.Models.AutoToolChoice","type":"Class"},{"name":"Base64Source","href":"AnthropicClient.Models.Base64Source.html","topicHref":"AnthropicClient.Models.Base64Source.html","topicUid":"AnthropicClient.Models.Base64Source","type":"Class"},{"name":"BaseMessageRequest","href":"AnthropicClient.Models.BaseMessageRequest.html","topicHref":"AnthropicClient.Models.BaseMessageRequest.html","topicUid":"AnthropicClient.Models.BaseMessageRequest","type":"Class"},{"name":"CacheControl","href":"AnthropicClient.Models.CacheControl.html","topicHref":"AnthropicClient.Models.CacheControl.html","topicUid":"AnthropicClient.Models.CacheControl","type":"Class"},{"name":"CacheControlType","href":"AnthropicClient.Models.CacheControlType.html","topicHref":"AnthropicClient.Models.CacheControlType.html","topicUid":"AnthropicClient.Models.CacheControlType","type":"Class"},{"name":"CanceledMessageBatchResult","href":"AnthropicClient.Models.CanceledMessageBatchResult.html","topicHref":"AnthropicClient.Models.CanceledMessageBatchResult.html","topicUid":"AnthropicClient.Models.CanceledMessageBatchResult","type":"Class"},{"name":"CharacterLocationCitation","href":"AnthropicClient.Models.CharacterLocationCitation.html","topicHref":"AnthropicClient.Models.CharacterLocationCitation.html","topicUid":"AnthropicClient.Models.CharacterLocationCitation","type":"Class"},{"name":"Citation","href":"AnthropicClient.Models.Citation.html","topicHref":"AnthropicClient.Models.Citation.html","topicUid":"AnthropicClient.Models.Citation","type":"Class"},{"name":"CitationDelta","href":"AnthropicClient.Models.CitationDelta.html","topicHref":"AnthropicClient.Models.CitationDelta.html","topicUid":"AnthropicClient.Models.CitationDelta","type":"Class"},{"name":"CitationOption","href":"AnthropicClient.Models.CitationOption.html","topicHref":"AnthropicClient.Models.CitationOption.html","topicUid":"AnthropicClient.Models.CitationOption","type":"Class"},{"name":"CitationType","href":"AnthropicClient.Models.CitationType.html","topicHref":"AnthropicClient.Models.CitationType.html","topicUid":"AnthropicClient.Models.CitationType","type":"Class"},{"name":"Content","href":"AnthropicClient.Models.Content.html","topicHref":"AnthropicClient.Models.Content.html","topicUid":"AnthropicClient.Models.Content","type"Line truncated
|
||||
-113
@@ -227,119 +227,6 @@ if (response.IsFailure)
|
||||
|
||||
Console.WriteLine("Model Id: {0}", 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, you’ll 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("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})");
|
||||
}
|
||||
</code></pre>
|
||||
<h5 id="from-a-stream">From a Stream</h5>
|
||||
<pre><code class="lang-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})");
|
||||
}
|
||||
</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($"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...");
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h5 id="with-pagination-options">With Pagination Options</h5>
|
||||
<pre><code class="lang-csharp">var pagingRequest = new PagingRequest(afterId: "file_12345", 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($"- {file.Name} (ID: {file.Id})");
|
||||
}
|
||||
}
|
||||
}
|
||||
</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("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}");
|
||||
}
|
||||
</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("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);
|
||||
}
|
||||
</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("file_12345");
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
var deleteResponse = result.Value;
|
||||
Console.WriteLine($"Deleted file: {deleteResponse.Id}");
|
||||
Console.WriteLine($"Type: {deleteResponse.Type}");
|
||||
}
|
||||
</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>
|
||||
|
||||
+8
-33
@@ -2,12 +2,12 @@
|
||||
"api/AnthropicClient.AnthropicApiClient.html": {
|
||||
"href": "api/AnthropicClient.AnthropicApiClient.html",
|
||||
"title": "Class AnthropicApiClient | AnthropicClient",
|
||||
"summary": "Class AnthropicApiClient Namespace AnthropicClient Assembly AnthropicClient.dll Represents a client for interacting with the Anthropic API. public class AnthropicApiClient : IAnthropicApiClient Inheritance object AnthropicApiClient Implements IAnthropicApiClient Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors AnthropicApiClient(string, HttpClient) Initializes a new instance of the AnthropicApiClient class. public AnthropicApiClient(string apiKey, HttpClient httpClient) Parameters apiKey string The API key to use for the client. httpClient HttpClient The HTTP client to use for the client. Exceptions ArgumentNullException Thrown when the API key or HTTP client is null. Methods CancelMessageBatchAsync(string, CancellationToken) Cancels a message batch asynchronously. public Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to cancel. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken) Counts the tokens in a message asynchronously. public Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request, CancellationToken cancellationToken = default) Parameters request CountMessageTokensRequest The count message tokens request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<TokenCountResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse. CreateFileAsync(CreateFileRequest, CancellationToken) Creates a file asynchronously using the Files API. public Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default) Parameters request CreateFileRequest The file creation request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<AnthropicFile>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFile. CreateMessageAsync(MessageRequest, CancellationToken) Creates a message asynchronously. public Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request, CancellationToken cancellationToken = default) Parameters request MessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>. CreateMessageAsync(StreamMessageRequest, CancellationToken) Creates a message asynchronously and streams the response. public IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request, CancellationToken cancellationToken = default) Parameters request StreamMessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns IAsyncEnumerable<AnthropicEvent> An asynchronous enumerable that yields the response event by event. CreateMessageBatchAsync(MessageBatchRequest, CancellationToken) Creates a batch of messages asynchronously. public Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request, CancellationToken cancellationToken = default) Parameters request MessageBatchRequest The message batch request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. DeleteFileAsync(string, CancellationToken) Deletes a file by its ID asynchronously. public Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default) Parameters fileId string The ID of the file to delete. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<AnthropicFileDeleteResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFileDeleteResponse. DeleteMessageBatchAsync(string, CancellationToken) Deletes a message batch asynchronously. public Task<AnthropicResult<MessageBatchDeleLine truncated
|
||||
"summary": "Class AnthropicApiClient Namespace AnthropicClient Assembly AnthropicClient.dll Represents a client for interacting with the Anthropic API. public class AnthropicApiClient : IAnthropicApiClient Inheritance object AnthropicApiClient Implements IAnthropicApiClient Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors AnthropicApiClient(string, HttpClient) Initializes a new instance of the AnthropicApiClient class. public AnthropicApiClient(string apiKey, HttpClient httpClient) Parameters apiKey string The API key to use for the client. httpClient HttpClient The HTTP client to use for the client. Exceptions ArgumentNullException Thrown when the API key or HTTP client is null. Methods CancelMessageBatchAsync(string, CancellationToken) Cancels a message batch asynchronously. public Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to cancel. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken) Counts the tokens in a message asynchronously. public Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request, CancellationToken cancellationToken = default) Parameters request CountMessageTokensRequest The count message tokens request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<TokenCountResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse. CreateMessageAsync(MessageRequest, CancellationToken) Creates a message asynchronously. public Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request, CancellationToken cancellationToken = default) Parameters request MessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>. CreateMessageAsync(StreamMessageRequest, CancellationToken) Creates a message asynchronously and streams the response. public IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request, CancellationToken cancellationToken = default) Parameters request StreamMessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns IAsyncEnumerable<AnthropicEvent> An asynchronous enumerable that yields the response event by event. CreateMessageBatchAsync(MessageBatchRequest, CancellationToken) Creates a batch of messages asynchronously. public Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request, CancellationToken cancellationToken = default) Parameters request MessageBatchRequest The message batch request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. DeleteMessageBatchAsync(string, CancellationToken) Deletes a message batch asynchronously. public Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to delete. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchDeleteResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchDeleteResponse. GetMessageBatchAsync(string, CancellationToken) Gets a message batch asynchronously. public Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to get. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. GetMessageBatchResultsAsync(string, CancellationToken) Gets the results of a message batch asynchronously. public Task<Line truncated
|
||||
},
|
||||
"api/AnthropicClient.IAnthropicApiClient.html": {
|
||||
"href": "api/AnthropicClient.IAnthropicApiClient.html",
|
||||
"title": "Interface IAnthropicApiClient | AnthropicClient",
|
||||
"summary": "Interface IAnthropicApiClient Namespace AnthropicClient Assembly AnthropicClient.dll Represents a client for interacting with the Anthropic API. public interface IAnthropicApiClient Methods CancelMessageBatchAsync(string, CancellationToken) Cancels a message batch asynchronously. Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to cancel. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken) Counts the tokens in a message asynchronously. Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request, CancellationToken cancellationToken = default) Parameters request CountMessageTokensRequest The count message tokens request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<TokenCountResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse. CreateFileAsync(CreateFileRequest, CancellationToken) Creates a file asynchronously using the Files API. Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default) Parameters request CreateFileRequest The file creation request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<AnthropicFile>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFile. CreateMessageAsync(MessageRequest, CancellationToken) Creates a message asynchronously. Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request, CancellationToken cancellationToken = default) Parameters request MessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>. CreateMessageAsync(StreamMessageRequest, CancellationToken) Creates a message asynchronously and streams the response. IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request, CancellationToken cancellationToken = default) Parameters request StreamMessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns IAsyncEnumerable<AnthropicEvent> An asynchronous enumerable that yields the response event by event. CreateMessageBatchAsync(MessageBatchRequest, CancellationToken) Creates a batch of messages asynchronously. Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request, CancellationToken cancellationToken = default) Parameters request MessageBatchRequest The message batch request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. DeleteFileAsync(string, CancellationToken) Deletes a file by its ID asynchronously. Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default) Parameters fileId string The ID of the file to delete. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<AnthropicFileDeleteResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is AnthropicFileDeleteResponse. DeleteMessageBatchAsync(string, CancellationToken) Deletes a message batch asynchronously. Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to delete. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchDeleteResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchDeleteResponse. GetFileAsync(string, CancellationToken) Gets a file's content by its ID asynchronously. Task<AnthropicResult<Stream>> GetFileAsync(string fileId, CancellationToken cancellationToken = default) Parameters fileId string The ID of the file to get theLine truncated
|
||||
"summary": "Interface IAnthropicApiClient Namespace AnthropicClient Assembly AnthropicClient.dll Represents a client for interacting with the Anthropic API. public interface IAnthropicApiClient Methods CancelMessageBatchAsync(string, CancellationToken) Cancels a message batch asynchronously. Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to cancel. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken) Counts the tokens in a message asynchronously. Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request, CancellationToken cancellationToken = default) Parameters request CountMessageTokensRequest The count message tokens request. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<TokenCountResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse. CreateMessageAsync(MessageRequest, CancellationToken) Creates a message asynchronously. Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request, CancellationToken cancellationToken = default) Parameters request MessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>. CreateMessageAsync(StreamMessageRequest, CancellationToken) Creates a message asynchronously and streams the response. IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request, CancellationToken cancellationToken = default) Parameters request StreamMessageRequest The message request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns IAsyncEnumerable<AnthropicEvent> An asynchronous enumerable that yields the response event by event. CreateMessageBatchAsync(MessageBatchRequest, CancellationToken) Creates a batch of messages asynchronously. Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request, CancellationToken cancellationToken = default) Parameters request MessageBatchRequest The message batch request to create. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. DeleteMessageBatchAsync(string, CancellationToken) Deletes a message batch asynchronously. Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to delete. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchDeleteResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchDeleteResponse. GetMessageBatchAsync(string, CancellationToken) Gets a message batch asynchronously. Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to get. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<MessageBatchResponse>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is MessageBatchResponse. GetMessageBatchResultsAsync(string, CancellationToken) Gets the results of a message batch asynchronously. Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> GetMessageBatchResultsAsync(string batchId, CancellationToken cancellationToken = default) Parameters batchId string The ID of the message batch to get the results for. cancellationToken CancellationToken A token to cancel the asynchronous operation. Returns Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is IAsyncEnumerable<T> where T is MessageBatchResultItem. GetModelAsync(string, CancellationToken) Gets a model by its ID asynchronously. Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modeLine truncated
|
||||
},
|
||||
"api/AnthropicClient.Models.AnthropicError.html": {
|
||||
"href": "api/AnthropicClient.Models.AnthropicError.html",
|
||||
@@ -19,16 +19,6 @@
|
||||
"title": "Class AnthropicEvent | AnthropicClient",
|
||||
"summary": "Class AnthropicEvent Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents an event from the Anthropic API. public class AnthropicEvent Inheritance object AnthropicEvent Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors AnthropicEvent(string, EventData) Initializes a new instance of the AnthropicEvent class. public AnthropicEvent(string type, EventData data) Parameters type string The type of the event. data EventData The data associated with the event. Properties Data The data associated with the event. public EventData Data { get; init; } Property Value EventData Type The type of the event. public string Type { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.AnthropicFile.html": {
|
||||
"href": "api/AnthropicClient.Models.AnthropicFile.html",
|
||||
"title": "Class AnthropicFile | AnthropicClient",
|
||||
"summary": "Class AnthropicFile Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a file object from the Anthropic Files API. public class AnthropicFile Inheritance object AnthropicFile Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Properties CreatedAt Date file was created. [JsonPropertyName(\"created_at\")] public DateTimeOffset CreatedAt { get; init; } Property Value DateTimeOffset Downloadable Whether the file can be downloaded. [JsonPropertyName(\"downloadable\")] public bool Downloadable { get; init; } Property Value bool Id Unique object identifier. [JsonPropertyName(\"id\")] public string Id { get; init; } Property Value string MimeType MIME type of the file. [JsonPropertyName(\"mime_type\")] public string MimeType { get; init; } Property Value string Name Original filename of the uploaded file. [JsonPropertyName(\"filename\")] public string Name { get; init; } Property Value string Size Size of the file in bytes. [JsonPropertyName(\"size_bytes\")] public long Size { get; init; } Property Value long Type Object type. [JsonPropertyName(\"type\")] public string Type { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.AnthropicFileDeleteResponse.html": {
|
||||
"href": "api/AnthropicClient.Models.AnthropicFileDeleteResponse.html",
|
||||
"title": "Class AnthropicFileDeleteResponse | AnthropicClient",
|
||||
"summary": "Class AnthropicFileDeleteResponse Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents the response from deleting a file in the Anthropic API. public class AnthropicFileDeleteResponse Inheritance object AnthropicFileDeleteResponse Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Properties Id Gets or sets the ID of the file that was deleted. public string Id { get; init; } Property Value string Type Gets or sets the response type public string Type { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.AnthropicFunction.html": {
|
||||
"href": "api/AnthropicClient.Models.AnthropicFunction.html",
|
||||
"title": "Class AnthropicFunction | AnthropicClient",
|
||||
@@ -47,7 +37,7 @@
|
||||
"api/AnthropicClient.Models.AnthropicModels.html": {
|
||||
"href": "api/AnthropicClient.Models.AnthropicModels.html",
|
||||
"title": "Class AnthropicModels | AnthropicClient",
|
||||
"summary": "Class AnthropicModels Namespace AnthropicClient.Models Assembly AnthropicClient.dll Provides constants for the Anthropic models. public static class AnthropicModels Inheritance object AnthropicModels Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Fields Claude35Haiku20241022 The Claude 3.5 Haiku model. public const string Claude35Haiku20241022 = \"claude-3-5-haiku-20241022\" Field Value string Claude35HaikuLatest The Claude 3.5 Haiku model. public const string Claude35HaikuLatest = \"claude-3-5-haiku-latest\" Field Value string Claude35Sonnet The Claude 3.5 Sonnet model. public const string Claude35Sonnet = \"claude-3-5-sonnet-20240620\" Field Value string Claude35Sonnet20240620 The Claude 3.5 Sonnet model. public const string Claude35Sonnet20240620 = \"claude-3-5-sonnet-20240620\" Field Value string Claude35Sonnet20241022 The Claude 3.5 Sonnet model. public const string Claude35Sonnet20241022 = \"claude-3-5-sonnet-20241022\" Field Value string Claude35SonnetLatest The Claude 3.5 Sonnet model. public const string Claude35SonnetLatest = \"claude-3-5-sonnet-latest\" Field Value string Claude37Sonnet20250219 The Claude 3 Sonnet model public const string Claude37Sonnet20250219 = \"claude-3-7-sonnet-20250219\" Field Value string Claude37SonnetLatest The Claude 3 Sonnet model public const string Claude37SonnetLatest = \"claude-3-7-sonnet-latest\" Field Value string Claude3Haiku The Claude 3 Haiku model. public const string Claude3Haiku = \"claude-3-haiku-20240307\" Field Value string Claude3Haiku20240307 The Claude 3 Haiku model. public const string Claude3Haiku20240307 = \"claude-3-haiku-20240307\" Field Value string Claude3Opus The Claude 3 Opus model. public const string Claude3Opus = \"claude-3-opus-20240229\" Field Value string Claude3Opus20241022 The Claude 3 Opus model. public const string Claude3Opus20241022 = \"claude-3-opus-20240229\" Field Value string Claude3OpusLatest The Claude 3 Opus model. public const string Claude3OpusLatest = \"claude-3-opus-latest\" Field Value string Claude3Sonnet The Claude 3 Sonnet model. public const string Claude3Sonnet = \"claude-3-sonnet-20240229\" Field Value string Claude3Sonnet20240229 The Claude 3 Sonnet model. public const string Claude3Sonnet20240229 = \"claude-3-sonnet-20240229\" Field Value string ClaudeOpus40 The Claude 4 Opus model. public const string ClaudeOpus40 = \"claude-opus-4-0\" Field Value string ClaudeOpus420250514 The Claude 4 Opus model. public const string ClaudeOpus420250514 = \"claude-opus-4-20250514\" Field Value string ClaudeSonnet40 The Claude 4 Sonnet model. public const string ClaudeSonnet40 = \"claude-sonnet-4-0\" Field Value string ClaudeSonnet420250514 The Claude 4 Sonnet model. public const string ClaudeSonnet420250514 = \"claude-sonnet-4-20250514\" Field Value string"
|
||||
"summary": "Class AnthropicModels Namespace AnthropicClient.Models Assembly AnthropicClient.dll Provides constants for the Anthropic models. public static class AnthropicModels Inheritance object AnthropicModels Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Fields Claude35Haiku20241022 The Claude 3.5 Haiku model. public const string Claude35Haiku20241022 = \"claude-3-5-haiku-20241022\" Field Value string Claude35HaikuLatest The Claude 3.5 Haiku model. public const string Claude35HaikuLatest = \"claude-3-5-haiku-latest\" Field Value string Claude35Sonnet The Claude 3.5 Sonnet model. public const string Claude35Sonnet = \"claude-3-5-sonnet-20240620\" Field Value string Claude35Sonnet20240620 The Claude 3.5 Sonnet model. public const string Claude35Sonnet20240620 = \"claude-3-5-sonnet-20240620\" Field Value string Claude35Sonnet20241022 The Claude 3.5 Sonnet model. public const string Claude35Sonnet20241022 = \"claude-3-5-sonnet-20241022\" Field Value string Claude35SonnetLatest The Claude 3.5 Sonnet model. public const string Claude35SonnetLatest = \"claude-3-5-sonnet-latest\" Field Value string Claude3Haiku The Claude 3 Haiku model. public const string Claude3Haiku = \"claude-3-haiku-20240307\" Field Value string Claude3Haiku20240307 The Claude 3 Haiku model. public const string Claude3Haiku20240307 = \"claude-3-haiku-20240307\" Field Value string Claude3Opus The Claude 3 Opus model. public const string Claude3Opus = \"claude-3-opus-20240229\" Field Value string Claude3Opus20241022 The Claude 3 Opus model. public const string Claude3Opus20241022 = \"claude-3-opus-20240229\" Field Value string Claude3OpusLatest The Claude 3 Opus model. public const string Claude3OpusLatest = \"claude-3-opus-latest\" Field Value string Claude3Sonnet The Claude 3 Sonnet model. public const string Claude3Sonnet = \"claude-3-sonnet-20240229\" Field Value string Claude3Sonnet20240229 The Claude 3 Sonnet model. public const string Claude3Sonnet20240229 = \"claude-3-sonnet-20240229\" Field Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.AnyToolChoice.html": {
|
||||
"href": "api/AnthropicClient.Models.AnyToolChoice.html",
|
||||
@@ -164,11 +154,6 @@
|
||||
"title": "Class CountMessageTokensRequest | AnthropicClient",
|
||||
"summary": "Class CountMessageTokensRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a request to count the number of tokens in a message. public class CountMessageTokensRequest Inheritance object CountMessageTokensRequest Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors CountMessageTokensRequest(string, List<Message>, ToolChoice?, List<Tool>?, List<TextContent>?) Initializes a new instance of the CountMessageTokensRequest class. public CountMessageTokensRequest(string model, List<Message> messages, ToolChoice? toolChoice = null, List<Tool>? tools = null, List<TextContent>? systemPrompt = null) Parameters model string The model ID to use for the request. messages List<Message> The messages to count the number of tokens in. toolChoice ToolChoice The tool choice mode to use for the request. tools List<Tool> The tools to use for the request. systemPrompt List<TextContent> The system prompt to use for the request. Exceptions ArgumentNullException Thrown when model or messages is null. ArgumentException Thrown when messages is empty. Properties Messages Gets the messages to count the number of tokens in. public List<Message> Messages { get; init; } Property Value List<Message> Model Gets the model ID to be used for the request. public string Model { get; init; } Property Value string SystemPrompt Gets the system prompt to use for the request. [JsonPropertyName(\"system\")] public List<TextContent>? SystemPrompt { get; init; } Property Value List<TextContent> ToolChoice Gets the tool choice mode to use for the request. [JsonPropertyName(\"tool_choice\")] public ToolChoice? ToolChoice { get; init; } Property Value ToolChoice Tools Gets the tools to use for the request. public List<Tool>? Tools { get; init; } Property Value List<Tool>"
|
||||
},
|
||||
"api/AnthropicClient.Models.CreateFileRequest.html": {
|
||||
"href": "api/AnthropicClient.Models.CreateFileRequest.html",
|
||||
"title": "Class CreateFileRequest | AnthropicClient",
|
||||
"summary": "Class CreateFileRequest Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a request to create a file via the Anthropic Files API. public class CreateFileRequest Inheritance object CreateFileRequest Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors CreateFileRequest(byte[], string, string) Initializes a new instance of the CreateFileRequest class. public CreateFileRequest(byte[] file, string fileName, string fileType) Parameters file byte[] The file content as a byte array. fileName string The original filename of the file being uploaded. fileType string The MIME type of the file. Exceptions ArgumentNullException Thrown when file is null. ArgumentException Thrown when fileName or fileType is null or whitespace. CreateFileRequest(Stream, string, string) Initializes a new instance of the CreateFileRequest class from a stream. public CreateFileRequest(Stream stream, string fileName, string fileType) Parameters stream Stream The stream containing the file content. fileName string The original filename of the file being uploaded. fileType string The MIME type of the file. Exceptions ArgumentNullException Thrown when stream is null. ArgumentException Thrown when fileName or fileType is null or whitespace. Properties File The file content as a byte array. public byte[] File { get; init; } Property Value byte[] FileName The original filename of the file being uploaded. public string FileName { get; init; } Property Value string FileType The MIME type of the file. public string FileType { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.CustomSource.html": {
|
||||
"href": "api/AnthropicClient.Models.CustomSource.html",
|
||||
"title": "Class CustomSource | AnthropicClient",
|
||||
@@ -224,11 +209,6 @@
|
||||
"title": "Class ExpiredMessageBatchResult | AnthropicClient",
|
||||
"summary": "Class ExpiredMessageBatchResult Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a message batch result that has expired. public class ExpiredMessageBatchResult : MessageBatchResult Inheritance object MessageBatchResult ExpiredMessageBatchResult Inherited Members MessageBatchResult.Type object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors ExpiredMessageBatchResult() Initializes a new instance of the ExpiredMessageBatchResult class. public ExpiredMessageBatchResult()"
|
||||
},
|
||||
"api/AnthropicClient.Models.FileSource.html": {
|
||||
"href": "api/AnthropicClient.Models.FileSource.html",
|
||||
"title": "Class FileSource | AnthropicClient",
|
||||
"summary": "Class FileSource Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a file source in the Anthropic API. public class FileSource : Source Inheritance object Source FileSource Inherited Members Source.Type object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors FileSource() Initializes a new instance of the FileSource class. public FileSource() FileSource(string) Initializes a new instance of the FileSource class with a specified file ID. public FileSource(string id) Parameters id string The unique identifier for the file source. Properties Id Gets or sets the unique identifier for the file source. [JsonPropertyName(\"file_id\")] public string Id { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.FunctionParameterAttribute.html": {
|
||||
"href": "api/AnthropicClient.Models.FunctionParameterAttribute.html",
|
||||
"title": "Class FunctionParameterAttribute | AnthropicClient",
|
||||
@@ -247,7 +227,7 @@
|
||||
"api/AnthropicClient.Models.ImageContent.html": {
|
||||
"href": "api/AnthropicClient.Models.ImageContent.html",
|
||||
"title": "Class ImageContent | AnthropicClient",
|
||||
"summary": "Class ImageContent Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents image content that is part of a message. public class ImageContent : Content Inheritance object Content ImageContent Inherited Members Content.Type Content.CacheControl object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors ImageContent(Source) Initializes a new instance of the ImageContent class. public ImageContent(Source source) Parameters source Source The source of the image. Exceptions ArgumentNullException Thrown when the source is null. ImageContent(Source, CacheControl) Initializes a new instance of the ImageContent class. public ImageContent(Source source, CacheControl cacheControl) Parameters source Source The source of the image. cacheControl CacheControl The cache control to be used for the content. Exceptions ArgumentNullException Thrown when the source or cache control is null. ImageContent(string, string) Initializes a new instance of the ImageContent class. public ImageContent(string mediaType, string data) Parameters mediaType string The media type of the image. data string The data of the image. Exceptions ArgumentNullException Thrown when the media type or data is null. ImageContent(string, string, CacheControl) Initializes a new instance of the ImageContent class. public ImageContent(string mediaType, string data, CacheControl cacheControl) Parameters mediaType string The media type of the image. data string The data of the image. cacheControl CacheControl The cache control to be used for the content. Exceptions ArgumentNullException Thrown when the media type, data, or cache control is null. Properties Source Gets the source of the image. public Source Source { get; init; } Property Value Source"
|
||||
"summary": "Class ImageContent Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents image content that is part of a message. public class ImageContent : Content Inheritance object Content ImageContent Inherited Members Content.Type Content.CacheControl object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors ImageContent(string, string) Initializes a new instance of the ImageContent class. public ImageContent(string mediaType, string data) Parameters mediaType string The media type of the image. data string The data of the image. Exceptions ArgumentNullException Thrown when the media type or data is null. ImageContent(string, string, CacheControl) Initializes a new instance of the ImageContent class. public ImageContent(string mediaType, string data, CacheControl cacheControl) Parameters mediaType string The media type of the image. data string The data of the image. cacheControl CacheControl The cache control to be used for the content. Exceptions ArgumentNullException Thrown when the media type, data, or cache control is null. Properties Source Gets the source of the image. public Source Source { get; init; } Property Value Source"
|
||||
},
|
||||
"api/AnthropicClient.Models.ImageSource.html": {
|
||||
"href": "api/AnthropicClient.Models.ImageSource.html",
|
||||
@@ -417,12 +397,12 @@
|
||||
"api/AnthropicClient.Models.Source.html": {
|
||||
"href": "api/AnthropicClient.Models.Source.html",
|
||||
"title": "Class Source | AnthropicClient",
|
||||
"summary": "Class Source Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a base class for sources. public abstract class Source Inheritance object Source Derived Base64Source CustomSource FileSource TextSource UrlSource Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors Source(string) Initializes a new instance of the Source class. protected Source(string type) Parameters type string The type of the source. Properties Type Gets the type of the source. public string Type { get; init; } Property Value string"
|
||||
"summary": "Class Source Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a base class for sources. public abstract class Source Inheritance object Source Derived Base64Source CustomSource TextSource Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors Source(string) Initializes a new instance of the Source class. protected Source(string type) Parameters type string The type of the source. Properties Type Gets the type of the source. public string Type { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.SourceType.html": {
|
||||
"href": "api/AnthropicClient.Models.SourceType.html",
|
||||
"title": "Class SourceType | AnthropicClient",
|
||||
"summary": "Class SourceType Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents the types of document sources that can be used in the Anthropic API. public static class SourceType Inheritance object SourceType Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Fields Base64 The base64 encoded document source type. public const string Base64 = \"base64\" Field Value string Content The custom content document source type. public const string Content = \"content\" Field Value string File The file document source type. public const string File = \"file\" Field Value string Text The text document source type. public const string Text = \"text\" Field Value string Url The URL document source type. public const string Url = \"url\" Field Value string"
|
||||
"summary": "Class SourceType Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents the types of document sources that can be used in the Anthropic API. public static class SourceType Inheritance object SourceType Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Fields Base64 The base64 encoded document source type. public const string Base64 = \"base64\" Field Value string Content The custom content document source type. public const string Content = \"content\" Field Value string Text The text document source type. public const string Text = \"text\" Field Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.SpecificToolChoice.html": {
|
||||
"href": "api/AnthropicClient.Models.SpecificToolChoice.html",
|
||||
@@ -499,11 +479,6 @@
|
||||
"title": "Class ToolUseContent | AnthropicClient",
|
||||
"summary": "Class ToolUseContent Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents tool use content that is part of a message. public class ToolUseContent : Content Inheritance object Content ToolUseContent Inherited Members Content.Type Content.CacheControl object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors ToolUseContent() Initializes a new instance of the ToolUseContent class. public ToolUseContent() Properties Id Gets the ID of the tool use. public string Id { get; init; } Property Value string Input Gets the input of the tool. public Dictionary<string, object?> Input { get; init; } Property Value Dictionary<string, object> Name Gets the name of the tool. public string Name { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.UrlSource.html": {
|
||||
"href": "api/AnthropicClient.Models.UrlSource.html",
|
||||
"title": "Class UrlSource | AnthropicClient",
|
||||
"summary": "Class UrlSource Namespace AnthropicClient.Models Assembly AnthropicClient.dll Represents a URL source in the Anthropic API. public class UrlSource : Source Inheritance object Source UrlSource Inherited Members Source.Type object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() Constructors UrlSource() Initializes a new instance of the UrlSource class. public UrlSource() UrlSource(string) Initializes a new instance of the UrlSource class with a specified URL. public UrlSource(string url) Parameters url string The URL of the source document. Properties Url Gets or sets the URL of the source document. public string Url { get; init; } Property Value string"
|
||||
},
|
||||
"api/AnthropicClient.Models.Usage.html": {
|
||||
"href": "api/AnthropicClient.Models.Usage.html",
|
||||
"title": "Class Usage | AnthropicClient",
|
||||
@@ -512,7 +487,7 @@
|
||||
"api/AnthropicClient.Models.html": {
|
||||
"href": "api/AnthropicClient.Models.html",
|
||||
"title": "Namespace AnthropicClient.Models | AnthropicClient",
|
||||
"summary": "Namespace AnthropicClient.Models Classes AnthropicError Represents an error response from the Anthropic API. AnthropicEvent Represents an event from the Anthropic API. AnthropicFile Represents a file object from the Anthropic Files API. AnthropicFileDeleteResponse Represents the response from deleting a file in the Anthropic API. AnthropicFunction Represents a function that can be provided as a tool. AnthropicHeaders Represents headers included in Anthropic API responses. AnthropicModel Represents an Anthropic model. AnthropicModels Provides constants for the Anthropic models. AnyToolChoice Represents the any tool choice mode. ApiError Represents an api_error response from the Anthropic API. AuthenticationError Represents an authentication_error response from the Anthropic API. AutoToolChoice Represents the auto tool choice mode. Base64Source Represents a base64 source. BaseMessageRequest Represents a message request. CacheControl Represents the cache control to be used for content. CacheControlType Provides constants for cache control types. CanceledMessageBatchResult Represents a message batch result that was cancelled. CharacterLocationCitation Represents a citation for specific locations within text content. Citation Represents a citation CitationDelta Represents a citation delta. CitationOption Represents whether citations are enabled for a document. CitationType The types of citations that can be returned by the Anthropic API. Content Represents part of the content of a message. ContentBlockLocationCitation Represents a citation for content blocks within custom content. ContentDelta Represents a content delta. ContentDeltaEventData Represents data for a content_block_delta event. ContentDeltaType Provides constants for content delta types. ContentStartEventData Represents data for a content_block_start event. ContentStopEventData Represents data for a content_block_stop event. ContentType Represents the content type. CountMessageTokensRequest Represents a request to count the number of tokens in a message. CreateFileRequest Represents a request to create a file via the Anthropic Files API. CustomSource Represents a custom source that contains a list of text content. DocumentContent Represents content from a document that is part of a message. DocumentSource Represents a document source. EphemeralCacheControl Represents the cache control to be used for content. Error Represents an error. ErrorEventData Represents data for an error event. ErrorType Represents the error type. ErroredMessageBatchResult Represents a message batch result that contains an error response. EventData Represents data for an event. EventType Provides constants for event types. ExpiredMessageBatchResult Represents a message batch result that has expired. FileSource Represents a file source in the Anthropic API. FunctionParameterAttribute Attribute to describe a function parameter. FunctionPropertyAttribute Attribute to describe a property of a type that is used as a function parameter. ImageContent Represents image content that is part of a message. ImageSource Represents an image source. ImageType Represents the image type. InputProperty Represents an input property. InputSchema Represents an input schema. InvalidRequestError Represents an invalid_request error. JsonDelta Represents a JSON delta. Message Represents a message. MessageBatchDeleteResponse Represents a message batch delete response. MessageBatchRequest Represents a request to create a batch of messages. MessageBatchRequestCounts Represents the counts of requests in a batch of messages. MessageBatchRequestItem Represents an item in a batch of messages. MessageBatchResponse Represents a response to a batch of messages. MessageBatchResult Represents a message batch result. MessageBatchResultItem Represents a message batch result item. MessageBatchResultType Represents the types of message batch results. MessageBatchStatus Represents the status of a message batch. MessageCompleteEventData Represents data for the message_complete event. MessageDelta Represents a message delta. MessageDeltaEventData Represents data for a message_delta event. MessageRequest Represents a message request. MessageResponse Represents a response. MessageRole Represents the message role. MessageStartEventData Represents data for a message_start event. MessageStopEventData Represents data for a message_stop event. NotFoundError Represents a not_found error. OverloadedError Represents an overloaded error. Page Represents a page. PageLocationCitation Represents a citation for text within a page of a document. Page<T> Represents a page with data. PagingRequest Represents a request to page through a collection of items. PermissionError Represents a permission error. PingEventData Represents data for a ping event. RateLimitError Represents a rate_limit error. Source Represents a base class for sources. SourceType Represents the types of document sources that can be used in the AnthropiLine truncated
|
||||
"summary": "Namespace AnthropicClient.Models Classes AnthropicError Represents an error response from the Anthropic API. AnthropicEvent Represents an event from the Anthropic API. AnthropicFunction Represents a function that can be provided as a tool. AnthropicHeaders Represents headers included in Anthropic API responses. AnthropicModel Represents an Anthropic model. AnthropicModels Provides constants for the Anthropic models. AnyToolChoice Represents the any tool choice mode. ApiError Represents an api_error response from the Anthropic API. AuthenticationError Represents an authentication_error response from the Anthropic API. AutoToolChoice Represents the auto tool choice mode. Base64Source Represents a base64 source. BaseMessageRequest Represents a message request. CacheControl Represents the cache control to be used for content. CacheControlType Provides constants for cache control types. CanceledMessageBatchResult Represents a message batch result that was cancelled. CharacterLocationCitation Represents a citation for specific locations within text content. Citation Represents a citation CitationDelta Represents a citation delta. CitationOption Represents whether citations are enabled for a document. CitationType The types of citations that can be returned by the Anthropic API. Content Represents part of the content of a message. ContentBlockLocationCitation Represents a citation for content blocks within custom content. ContentDelta Represents a content delta. ContentDeltaEventData Represents data for a content_block_delta event. ContentDeltaType Provides constants for content delta types. ContentStartEventData Represents data for a content_block_start event. ContentStopEventData Represents data for a content_block_stop event. ContentType Represents the content type. CountMessageTokensRequest Represents a request to count the number of tokens in a message. CustomSource Represents a custom source that contains a list of text content. DocumentContent Represents content from a document that is part of a message. DocumentSource Represents a document source. EphemeralCacheControl Represents the cache control to be used for content. Error Represents an error. ErrorEventData Represents data for an error event. ErrorType Represents the error type. ErroredMessageBatchResult Represents a message batch result that contains an error response. EventData Represents data for an event. EventType Provides constants for event types. ExpiredMessageBatchResult Represents a message batch result that has expired. FunctionParameterAttribute Attribute to describe a function parameter. FunctionPropertyAttribute Attribute to describe a property of a type that is used as a function parameter. ImageContent Represents image content that is part of a message. ImageSource Represents an image source. ImageType Represents the image type. InputProperty Represents an input property. InputSchema Represents an input schema. InvalidRequestError Represents an invalid_request error. JsonDelta Represents a JSON delta. Message Represents a message. MessageBatchDeleteResponse Represents a message batch delete response. MessageBatchRequest Represents a request to create a batch of messages. MessageBatchRequestCounts Represents the counts of requests in a batch of messages. MessageBatchRequestItem Represents an item in a batch of messages. MessageBatchResponse Represents a response to a batch of messages. MessageBatchResult Represents a message batch result. MessageBatchResultItem Represents a message batch result item. MessageBatchResultType Represents the types of message batch results. MessageBatchStatus Represents the status of a message batch. MessageCompleteEventData Represents data for the message_complete event. MessageDelta Represents a message delta. MessageDeltaEventData Represents data for a message_delta event. MessageRequest Represents a message request. MessageResponse Represents a response. MessageRole Represents the message role. MessageStartEventData Represents data for a message_start event. MessageStopEventData Represents data for a message_stop event. NotFoundError Represents a not_found error. OverloadedError Represents an overloaded error. Page Represents a page. PageLocationCitation Represents a citation for text within a page of a document. Page<T> Represents a page with data. PagingRequest Represents a request to page through a collection of items. PermissionError Represents a permission error. PingEventData Represents data for a ping event. RateLimitError Represents a rate_limit error. Source Represents a base class for sources. SourceType Represents the types of document sources that can be used in the Anthropic API. SpecificToolChoice Represents the specific tool choice mode. StopReasonType Represents the stop reason type. StreamMessageRequest Represents a message request. SucceededMessageBatchResult Represents a message batch result that contains a message response. TextContent Represents text content that is Line truncated
|
||||
},
|
||||
"api/AnthropicClient.html": {
|
||||
"href": "api/AnthropicClient.html",
|
||||
@@ -522,6 +497,6 @@
|
||||
"index.html": {
|
||||
"href": "index.html",
|
||||
"title": "AnthropicClient | AnthropicClient",
|
||||
"summary": "AnthropicClient This library for the Anthropic API is meant to simplify development in C# for Anthropic users. Note This is an unofficial SDK for the Anthropic API. It was not built in consultation with Anthropic or any member of their organization. This SDK was developed independently using existing libraries and the Anthropic API documentation as the starting point with the intention of making development of integrations done in C# with Anthropic quicker and more convenient. Note This client library is heavily inspired by the Anthropic.SDK library. I chose to create a new library because I wanted to handle streaming and tool calling differently as well as have control over the client library as I plan to use it to build a connector for SemanticKernel. However if you are looking for a client library the Anthropic.SDK is a great place to start. \uD83D\uDCDD Issues If you encounter any issues while using this library please open an issue here. \uD83D\uDCDC License This library is licensed under the MIT License and is free to use and modify. \uD83D\uDCDD Contributing If you would like to contribute to this library please open a pull request here. \uD83D\uDEE0️ Dependencies Microsoft.Bcl.AsyncInterfaces Used to support async interfaces when streaming messages System.Text.Json Used for JSON serialization and deserialization \uD83D\uDCBE Installation Install the package from NuGet using the following command: dotnet add package AnthropicClient \uD83D\uDD11 API Key In order to use the Anthropic API you will need an API key. You can get one by signing up at Anthropic. Please keep your API key secure and do not share it with others. Be mindful of where you store your API key and do not commit it to a public repository. \uD83D\uDC68\uD83C\uDFFB\uD83D\uDCBB Start Coding AnthropicApiClient The most common way to use the SDK is to create an AnthropicApiClient instance and call its methods. Its constructor requires two parameters: apiKey - your Anthropic API key httpClient - an HttpClient instance. You can configure and customize the HttpClient instance as needed. This library however will perform the necessary configuration to work with the Anthropic API. Such as setting the base address and adding the proper headers. Note This library does not manage the lifecycle of the HttpClient instance. You should create and manage the lifecycle of the HttpClient instance in your application. It is best practice to read the API key from a secure location such as a configuration file or environment variable. For example using the appsettings.json file: { \"AnthropicApiKey\": \"YOUR_API\" } Example constructing an AnthropicApiClient instance: using AnthropicClient; using Microsoft.Extensions.Configuration; var configuration = new ConfigurationBuilder() .AddJsonFile(\"appsettings.json\") .Build(); var apiKey = configuration[\"AnthropicApiKey\"]; var client = new AnthropicApiClient(apiKey, new HttpClient()); IAnthropicApiClient The library does expose an interface IAnthropicApiClient that can be used for dependency injection and testing. The interface is implemented by the AnthropicApiClient class. Full API Documentation This library was developed to make using the Anthropic API easier within a .NET application. If you are looking for the full API documentation you can find it at Anthropic API Documentation. Usage The primary use case for working with the Anthropic API is to create a message in response to a request that includes one or more other messages. The created message can then be received either as a complete response or a stream of events. This can be used to create a conversation between the caller and Anthropic's AI models and/or to use Anthropic's AI models to perform a task. Note The following examples assume that you have already created an instance of the AnthropicApiClient class named client. You can also find these snippets in the examples directory. Count Message Tokens The AnthropicApiClient exposes a method named CountMessageTokensAsync that can be used to count the number of tokens in a message. The method requires a CountMessageTokensRequest instance as a parameter. using AnthropicClient; using AnthropicClient.Models; var response = await client.CountMessageTokensAsync(new CountMessageTokensRequest( AnthropicModels.Claude3Haiku, [ new( MessageRole.User, [new TextContent(\"Please write a haiku about the ocean.\")] ) ] )); if (response.IsFailure) { Console.WriteLine(\"Failed to count message tokens\"); Console.WriteLine(\"Error Type: {0}\", response.Error.Error.Type); Console.WriteLine(\"Error Message: {0}\", response.Error.Error.Message); return; } Console.WriteLine(\"Token Count: {0}\", response.Value.InputTokens); List Models The AnthropicApiClient exposes a method named ListModelsAsync that can be used to list the available models. The method takes an optional PagingRequest instance as a parameter. using AnthropicClient; var response = await client.ListModelsAsync(); if (response.IsFailuLine truncated
|
||||
"summary": "AnthropicClient This library for the Anthropic API is meant to simplify development in C# for Anthropic users. Note This is an unofficial SDK for the Anthropic API. It was not built in consultation with Anthropic or any member of their organization. This SDK was developed independently using existing libraries and the Anthropic API documentation as the starting point with the intention of making development of integrations done in C# with Anthropic quicker and more convenient. Note This client library is heavily inspired by the Anthropic.SDK library. I chose to create a new library because I wanted to handle streaming and tool calling differently as well as have control over the client library as I plan to use it to build a connector for SemanticKernel. However if you are looking for a client library the Anthropic.SDK is a great place to start. \uD83D\uDCDD Issues If you encounter any issues while using this library please open an issue here. \uD83D\uDCDC License This library is licensed under the MIT License and is free to use and modify. \uD83D\uDCDD Contributing If you would like to contribute to this library please open a pull request here. \uD83D\uDEE0️ Dependencies Microsoft.Bcl.AsyncInterfaces Used to support async interfaces when streaming messages System.Text.Json Used for JSON serialization and deserialization \uD83D\uDCBE Installation Install the package from NuGet using the following command: dotnet add package AnthropicClient \uD83D\uDD11 API Key In order to use the Anthropic API you will need an API key. You can get one by signing up at Anthropic. Please keep your API key secure and do not share it with others. Be mindful of where you store your API key and do not commit it to a public repository. \uD83D\uDC68\uD83C\uDFFB\uD83D\uDCBB Start Coding AnthropicApiClient The most common way to use the SDK is to create an AnthropicApiClient instance and call its methods. Its constructor requires two parameters: apiKey - your Anthropic API key httpClient - an HttpClient instance. You can configure and customize the HttpClient instance as needed. This library however will perform the necessary configuration to work with the Anthropic API. Such as setting the base address and adding the proper headers. Note This library does not manage the lifecycle of the HttpClient instance. You should create and manage the lifecycle of the HttpClient instance in your application. It is best practice to read the API key from a secure location such as a configuration file or environment variable. For example using the appsettings.json file: { \"AnthropicApiKey\": \"YOUR_API\" } Example constructing an AnthropicApiClient instance: using AnthropicClient; using Microsoft.Extensions.Configuration; var configuration = new ConfigurationBuilder() .AddJsonFile(\"appsettings.json\") .Build(); var apiKey = configuration[\"AnthropicApiKey\"]; var client = new AnthropicApiClient(apiKey, new HttpClient()); IAnthropicApiClient The library does expose an interface IAnthropicApiClient that can be used for dependency injection and testing. The interface is implemented by the AnthropicApiClient class. Full API Documentation This library was developed to make using the Anthropic API easier within a .NET application. If you are looking for the full API documentation you can find it at Anthropic API Documentation. Usage The primary use case for working with the Anthropic API is to create a message in response to a request that includes one or more other messages. The created message can then be received either as a complete response or a stream of events. This can be used to create a conversation between the caller and Anthropic's AI models and/or to use Anthropic's AI models to perform a task. Note The following examples assume that you have already created an instance of the AnthropicApiClient class named client. You can also find these snippets in the examples directory. Count Message Tokens The AnthropicApiClient exposes a method named CountMessageTokensAsync that can be used to count the number of tokens in a message. The method requires a CountMessageTokensRequest instance as a parameter. using AnthropicClient; using AnthropicClient.Models; var response = await client.CountMessageTokensAsync(new CountMessageTokensRequest( AnthropicModels.Claude3Haiku, [ new( MessageRole.User, [new TextContent(\"Please write a haiku about the ocean.\")] ) ] )); if (response.IsFailure) { Console.WriteLine(\"Failed to count message tokens\"); Console.WriteLine(\"Error Type: {0}\", response.Error.Error.Type); Console.WriteLine(\"Error Message: {0}\", response.Error.Error.Message); return; } Console.WriteLine(\"Token Count: {0}\", response.Value.InputTokens); List Models The AnthropicApiClient exposes a method named ListModelsAsync that can be used to list the available models. The method takes an optional PagingRequest instance as a parameter. using AnthropicClient; var response = await client.ListModelsAsync(); if (response.IsFailuLine truncated
|
||||
}
|
||||
}
|
||||
@@ -66,34 +66,6 @@
|
||||
"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",
|
||||
@@ -472,20 +444,6 @@
|
||||
"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",
|
||||
@@ -640,20 +598,6 @@
|
||||
"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",
|
||||
@@ -1410,20 +1354,6 @@
|
||||
"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",
|
||||
|
||||
@@ -61,19 +61,6 @@ 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_
|
||||
@@ -106,22 +93,6 @@ 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_
|
||||
@@ -138,38 +109,6 @@ 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_
|
||||
@@ -218,22 +157,6 @@ 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_
|
||||
@@ -266,22 +189,6 @@ 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_
|
||||
@@ -349,19 +256,6 @@ 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_
|
||||
@@ -394,22 +288,6 @@ 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_
|
||||
@@ -426,38 +304,6 @@ 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_
|
||||
@@ -506,22 +352,6 @@ 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_
|
||||
@@ -554,22 +384,6 @@ 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_
|
||||
@@ -710,135 +524,6 @@ 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
|
||||
@@ -1100,18 +785,6 @@ 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
|
||||
@@ -1154,30 +827,6 @@ 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
|
||||
@@ -2259,79 +1908,6 @@ 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
|
||||
@@ -2822,53 +2398,6 @@ 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
|
||||
@@ -3061,24 +2590,6 @@ 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_
|
||||
@@ -4618,24 +4129,12 @@ 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
|
||||
@@ -5491,53 +4990,6 @@ 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
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
using AnthropicClient;
|
||||
using AnthropicClient.Models;
|
||||
|
||||
namespace AnthropicClient.Examples;
|
||||
|
||||
/// <summary>
|
||||
/// Example demonstrating file operations with the Anthropic API.
|
||||
/// </summary>
|
||||
public class FileOperationsExample
|
||||
{
|
||||
public static async Task RunExample()
|
||||
{
|
||||
// This is a demonstration of the file API methods
|
||||
// Note: You would need a real API key to run this example
|
||||
var client = new AnthropicApiClient("your-api-key", new HttpClient());
|
||||
|
||||
// Create a file
|
||||
var fileContent = "Hello, this is a sample file content!"u8.ToArray();
|
||||
var fileRequest = new FileRequest(fileContent, "sample.txt", "text/plain");
|
||||
|
||||
Console.WriteLine("Creating file...");
|
||||
var createResult = await client.CreateFileAsync(fileRequest);
|
||||
|
||||
if (createResult.IsFailure)
|
||||
{
|
||||
Console.WriteLine($"Failed to create file: {createResult.Error.Error.Message}");
|
||||
return;
|
||||
}
|
||||
|
||||
var fileId = createResult.Value.Id;
|
||||
Console.WriteLine($"File created with ID: {fileId}");
|
||||
|
||||
// List files
|
||||
Console.WriteLine("\nListing files...");
|
||||
var listResult = await client.ListFilesAsync();
|
||||
|
||||
if (listResult.IsSuccess)
|
||||
{
|
||||
Console.WriteLine($"Found {listResult.Value.Data.Length} files");
|
||||
foreach (var file in listResult.Value.Data)
|
||||
{
|
||||
Console.WriteLine($"- {file.Filename} ({file.Id})");
|
||||
}
|
||||
}
|
||||
|
||||
// Get file metadata
|
||||
Console.WriteLine($"\nGetting file metadata for {fileId}...");
|
||||
var getResult = await client.GetFileAsync(fileId);
|
||||
|
||||
if (getResult.IsSuccess)
|
||||
{
|
||||
var file = getResult.Value;
|
||||
Console.WriteLine($"File: {file.Filename}");
|
||||
Console.WriteLine($"Size: {file.SizeBytes} bytes");
|
||||
Console.WriteLine($"Content Type: {file.ContentType}");
|
||||
Console.WriteLine($"Created: {file.CreatedAt}");
|
||||
}
|
||||
|
||||
// Download file
|
||||
Console.WriteLine($"\nDownloading file {fileId}...");
|
||||
var downloadResult = await client.DownloadFileAsync(fileId);
|
||||
|
||||
if (downloadResult.IsSuccess)
|
||||
{
|
||||
var download = downloadResult.Value;
|
||||
var contentText = System.Text.Encoding.UTF8.GetString(download.Content);
|
||||
Console.WriteLine($"Downloaded content: {contentText}");
|
||||
}
|
||||
|
||||
// List all files with pagination
|
||||
Console.WriteLine("\nListing all files (with pagination)...");
|
||||
await foreach (var pageResult in client.ListAllFilesAsync(limit: 10))
|
||||
{
|
||||
if (pageResult.IsSuccess)
|
||||
{
|
||||
Console.WriteLine($"Page with {pageResult.Value.Data.Length} files");
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file
|
||||
Console.WriteLine($"\nDeleting file {fileId}...");
|
||||
var deleteResult = await client.DeleteFileAsync(fileId);
|
||||
|
||||
if (deleteResult.IsSuccess)
|
||||
{
|
||||
Console.WriteLine($"File deleted: {deleteResult.Value.Deleted}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,9 +382,18 @@ public class AnthropicApiClient : IAnthropicApiClient
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<AnthropicResult<AnthropicFile>> CreateFileAsync(CreateFileRequest request, CancellationToken cancellationToken = default)
|
||||
public async Task<AnthropicResult<AnthropicFile>> CreateFileAsync(FileRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var response = await SendFileRequestAsync(FilesEndpoint, request, cancellationToken);
|
||||
var formData = new MultipartFormDataContent();
|
||||
formData.Add(new ByteArrayContent(request.Content), "file", request.Filename);
|
||||
formData.Add(new StringContent(request.Purpose), "purpose");
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, FilesEndpoint)
|
||||
{
|
||||
Content = formData
|
||||
};
|
||||
|
||||
var response = await _httpClient.SendAsync(httpRequest, cancellationToken);
|
||||
return await CreateResultAsync<AnthropicFile>(response);
|
||||
}
|
||||
|
||||
@@ -407,7 +416,7 @@ public class AnthropicApiClient : IAnthropicApiClient
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<AnthropicResult<AnthropicFile>> GetFileInfoAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
public async Task<AnthropicResult<AnthropicFile>> GetFileAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var endpoint = $"{FilesEndpoint}/{fileId}";
|
||||
var response = await SendRequestAsync(endpoint, cancellationToken: cancellationToken);
|
||||
@@ -415,28 +424,34 @@ public class AnthropicApiClient : IAnthropicApiClient
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<AnthropicResult<Stream>> GetFileAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
public async Task<AnthropicResult<FileDownloadResponse>> DownloadFileAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var endpoint = $"{FilesEndpoint}/{fileId}/content";
|
||||
var response = await SendRequestAsync(endpoint, cancellationToken: cancellationToken);
|
||||
var anthropicHeaders = new AnthropicHeaders(response.Headers);
|
||||
|
||||
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 errorContent = await response.Content.ReadAsStringAsync();
|
||||
var error = Deserialize<AnthropicError>(errorContent) ?? new AnthropicError();
|
||||
return AnthropicResult<FileDownloadResponse>.Failure(error, anthropicHeaders);
|
||||
}
|
||||
|
||||
var stream = await response.Content.ReadAsStreamAsync();
|
||||
return AnthropicResult<Stream>.Success(stream, new AnthropicHeaders(response.Headers));
|
||||
var content = await response.Content.ReadAsByteArrayAsync();
|
||||
var contentType = response.Content.Headers.ContentType?.MediaType ?? "application/octet-stream";
|
||||
var filename = ExtractFilenameFromContentDisposition(response.Content.Headers.ContentDisposition?.FileName) ?? fileId;
|
||||
var sizeBytes = content.Length;
|
||||
|
||||
var downloadResponse = new FileDownloadResponse(content, filename, contentType, sizeBytes);
|
||||
return AnthropicResult<FileDownloadResponse>.Success(downloadResponse, anthropicHeaders);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<AnthropicResult<AnthropicFileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
public async Task<AnthropicResult<FileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var endpoint = $"{FilesEndpoint}/{fileId}";
|
||||
var response = await SendRequestAsync(endpoint, HttpMethod.Delete, cancellationToken);
|
||||
return await CreateResultAsync<AnthropicFileDeleteResponse>(response);
|
||||
return await CreateResultAsync<FileDeleteResponse>(response);
|
||||
}
|
||||
|
||||
private async IAsyncEnumerable<AnthropicResult<Page<T>>> GetAllPagesAsync<T>(string endpoint, int limit = 20, [EnumeratorCancellation] CancellationToken cancellationToken = default)
|
||||
@@ -508,6 +523,17 @@ public class AnthropicApiClient : IAnthropicApiClient
|
||||
return AnthropicResult<T>.Success(model, anthropicHeaders);
|
||||
}
|
||||
|
||||
private static string? ExtractFilenameFromContentDisposition(string? contentDisposition)
|
||||
{
|
||||
if (string.IsNullOrEmpty(contentDisposition))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Remove quotes if present
|
||||
return contentDisposition!.Trim('"');
|
||||
}
|
||||
|
||||
private async Task<HttpResponseMessage> SendRequestAsync(string endpoint, HttpMethod? method = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var request = new HttpRequestMessage(method ?? HttpMethod.Get, endpoint);
|
||||
@@ -521,17 +547,6 @@ 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);
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>AnthropicClient</PackageId>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.0.0</Version>
|
||||
<Authors>Stevan Freeborn</Authors>
|
||||
<Description>Anthropic Client Library</Description>
|
||||
<PackageProjectUrl>https://anthropicclient.stevanfreeborn.com/</PackageProjectUrl>
|
||||
|
||||
@@ -2,23 +2,6 @@
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -113,12 +113,12 @@ public interface IAnthropicApiClient
|
||||
Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a file asynchronously using the Files API.
|
||||
/// Creates a file asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="request">The file creation request.</param>
|
||||
/// <param name="request">The file request to create.</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);
|
||||
Task<AnthropicResult<AnthropicFile>> CreateFileAsync(FileRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Lists files asynchronously, returning a single page of results.
|
||||
@@ -137,27 +137,26 @@ public interface IAnthropicApiClient
|
||||
IAsyncEnumerable<AnthropicResult<Page<AnthropicFile>>> ListAllFilesAsync(int limit = 20, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a file's metadata by its ID asynchronously.
|
||||
/// Gets a file 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);
|
||||
Task<AnthropicResult<AnthropicFile>> GetFileAsync(string fileId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a file's content by its ID asynchronously.
|
||||
/// Downloads a file by its ID asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="fileId">The ID of the file to get the content for.</param>
|
||||
/// <param name="fileId">The ID of the file to download.</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);
|
||||
|
||||
/// <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="FileDownloadResponse"/>.</returns>
|
||||
Task<AnthropicResult<FileDownloadResponse>> DownloadFileAsync(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);
|
||||
/// <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="FileDeleteResponse"/>.</returns>
|
||||
Task<AnthropicResult<FileDeleteResponse>> DeleteFileAsync(string fileId, CancellationToken cancellationToken = default);
|
||||
}
|
||||
@@ -16,8 +16,6 @@ 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}")
|
||||
};
|
||||
@@ -56,18 +54,6 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -3,49 +3,40 @@ using System.Text.Json.Serialization;
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a file object from the Anthropic Files API.
|
||||
/// Represents a file in the Anthropic API.
|
||||
/// </summary>
|
||||
public class AnthropicFile
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique object identifier.
|
||||
/// The type of the object.
|
||||
/// </summary>
|
||||
public string Type { get; init; } = "file";
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier for the file.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Object type.
|
||||
/// The filename of the file.
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type { get; init; } = string.Empty;
|
||||
public string Filename { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Original filename of the uploaded file.
|
||||
/// The MIME type of the file.
|
||||
/// </summary>
|
||||
[JsonPropertyName("filename")]
|
||||
public string Name { get; init; } = string.Empty;
|
||||
[JsonPropertyName("content_type")]
|
||||
public string ContentType { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Date file was created.
|
||||
/// The size of the file in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("size_bytes")]
|
||||
public int SizeBytes { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The date and time when the 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; }
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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,16 +20,6 @@ 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>
|
||||
@@ -60,26 +50,6 @@ 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>
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
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,5 +1,7 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using AnthropicClient.Utils;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response from a file deletion operation.
|
||||
/// </summary>
|
||||
public class FileDeleteResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of the object.
|
||||
/// </summary>
|
||||
public string Type { get; init; } = "file_deleted";
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier for the deleted file.
|
||||
/// </summary>
|
||||
public string Id { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the file was successfully deleted.
|
||||
/// </summary>
|
||||
public bool Deleted { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response from downloading a file.
|
||||
/// </summary>
|
||||
public class FileDownloadResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The file content as a byte array.
|
||||
/// </summary>
|
||||
public byte[] Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The filename of the file.
|
||||
/// </summary>
|
||||
public string Filename { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The MIME type of the file.
|
||||
/// </summary>
|
||||
public string ContentType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The size of the file in bytes.
|
||||
/// </summary>
|
||||
public int SizeBytes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileDownloadResponse"/> class.
|
||||
/// </summary>
|
||||
/// <param name="content">The file content as a byte array.</param>
|
||||
/// <param name="filename">The filename of the file.</param>
|
||||
/// <param name="contentType">The MIME type of the file.</param>
|
||||
/// <param name="sizeBytes">The size of the file in bytes.</param>
|
||||
public FileDownloadResponse(byte[] content, string filename, string contentType, int sizeBytes)
|
||||
{
|
||||
Content = content;
|
||||
Filename = filename;
|
||||
ContentType = contentType;
|
||||
SizeBytes = sizeBytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using AnthropicClient.Utils;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request to create a file.
|
||||
/// </summary>
|
||||
public class FileRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The file content as a byte array.
|
||||
/// </summary>
|
||||
public byte[] Content { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The filename of the file.
|
||||
/// </summary>
|
||||
public string Filename { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The MIME type of the file.
|
||||
/// </summary>
|
||||
public string ContentType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The purpose of the file.
|
||||
/// </summary>
|
||||
public string Purpose { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FileRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="content">The file content as a byte array.</param>
|
||||
/// <param name="filename">The filename of the file.</param>
|
||||
/// <param name="contentType">The MIME type of the file.</param>
|
||||
/// <param name="purpose">The purpose of the file (default: "user_upload").</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when content, filename, or contentType is null.</exception>
|
||||
/// <exception cref="ArgumentException">Thrown when filename or contentType is empty.</exception>
|
||||
public FileRequest(byte[] content, string filename, string contentType, string purpose = "user_upload")
|
||||
{
|
||||
ArgumentValidator.ThrowIfNull(content, nameof(content));
|
||||
ArgumentValidator.ThrowIfNullOrWhitespace(filename, nameof(filename));
|
||||
ArgumentValidator.ThrowIfNullOrWhitespace(contentType, nameof(contentType));
|
||||
ArgumentValidator.ThrowIfNullOrWhitespace(purpose, nameof(purpose));
|
||||
|
||||
Content = content;
|
||||
Filename = filename;
|
||||
ContentType = contentType;
|
||||
Purpose = purpose;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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,32 +53,4 @@ 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,5 +1,7 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using AnthropicClient.Utils;
|
||||
|
||||
namespace AnthropicClient.Models;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,14 +19,4 @@ 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";
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
@@ -2,15 +2,8 @@ using AnthropicClient.Tests.Files;
|
||||
|
||||
namespace AnthropicClient.Tests.EndToEnd;
|
||||
|
||||
public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture), IAsyncLifetime
|
||||
public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture)
|
||||
{
|
||||
private readonly List<string> _filesToDelete = [];
|
||||
|
||||
public Task InitializeAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateMessageAsync_WhenCalled_ItShouldReturnResponse()
|
||||
{
|
||||
@@ -103,41 +96,11 @@ 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);
|
||||
|
||||
@@ -164,7 +127,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>();
|
||||
@@ -175,6 +138,8 @@ 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);
|
||||
|
||||
@@ -188,7 +153,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>();
|
||||
@@ -198,7 +163,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>();
|
||||
@@ -209,6 +174,8 @@ 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
|
||||
@@ -228,7 +195,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>();
|
||||
@@ -238,7 +205,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>();
|
||||
@@ -261,7 +228,9 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo
|
||||
]
|
||||
);
|
||||
|
||||
var result = await _client.CreateMessageAsync(request);
|
||||
var client = CreateClient(new HttpClient());
|
||||
|
||||
var result = await client.CreateMessageAsync(request);
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().BeOfType<MessageResponse>();
|
||||
@@ -287,6 +256,8 @@ 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: [
|
||||
@@ -297,7 +268,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>();
|
||||
@@ -307,7 +278,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>();
|
||||
@@ -424,58 +395,6 @@ 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()
|
||||
{
|
||||
@@ -597,64 +516,6 @@ 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()
|
||||
{
|
||||
@@ -826,120 +687,4 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
namespace AnthropicClient.Tests.Integration;
|
||||
|
||||
public class AnthropicApiClientFileTests : IntegrationTest
|
||||
{
|
||||
[Fact]
|
||||
public async Task CreateFileAsync_WhenCalled_ItShouldReturnFileResponse()
|
||||
{
|
||||
var fileResponseJson = @"{
|
||||
""type"": ""file"",
|
||||
""id"": ""file_abc123"",
|
||||
""filename"": ""example.txt"",
|
||||
""content_type"": ""text/plain"",
|
||||
""size_bytes"": 1024,
|
||||
""created_at"": ""2024-03-15T10:30:00Z""
|
||||
}";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenCreateFileRequest()
|
||||
.Respond(HttpStatusCode.OK, "application/json", fileResponseJson);
|
||||
|
||||
var content = "Hello World"u8.ToArray();
|
||||
var request = new FileRequest(content, "example.txt", "text/plain");
|
||||
|
||||
var result = await Client.CreateFileAsync(request);
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().NotBeNull();
|
||||
result.Value!.Id.Should().Be("file_abc123");
|
||||
result.Value.Filename.Should().Be("example.txt");
|
||||
result.Value.ContentType.Should().Be("text/plain");
|
||||
result.Value.SizeBytes.Should().Be(1024);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ListFilesAsync_WhenCalled_ItShouldReturnFilesPage()
|
||||
{
|
||||
var filesResponseJson = @"{
|
||||
""data"": [
|
||||
{
|
||||
""type"": ""file"",
|
||||
""id"": ""file_abc123"",
|
||||
""filename"": ""example.txt"",
|
||||
""content_type"": ""text/plain"",
|
||||
""size_bytes"": 1024,
|
||||
""created_at"": ""2024-03-15T10:30:00Z""
|
||||
}
|
||||
],
|
||||
""has_more"": false,
|
||||
""first_id"": ""file_abc123"",
|
||||
""last_id"": ""file_abc123""
|
||||
}";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenListFilesRequest()
|
||||
.Respond(HttpStatusCode.OK, "application/json", filesResponseJson);
|
||||
|
||||
var result = await Client.ListFilesAsync();
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().NotBeNull();
|
||||
result.Value!.Data.Should().HaveCount(1);
|
||||
result.Value.Data[0].Id.Should().Be("file_abc123");
|
||||
result.Value.HasMore.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetFileAsync_WhenCalled_ItShouldReturnFileResponse()
|
||||
{
|
||||
var fileResponseJson = @"{
|
||||
""type"": ""file"",
|
||||
""id"": ""file_abc123"",
|
||||
""filename"": ""example.txt"",
|
||||
""content_type"": ""text/plain"",
|
||||
""size_bytes"": 1024,
|
||||
""created_at"": ""2024-03-15T10:30:00Z""
|
||||
}";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenGetFileRequest("file_abc123")
|
||||
.Respond(HttpStatusCode.OK, "application/json", fileResponseJson);
|
||||
|
||||
var result = await Client.GetFileAsync("file_abc123");
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().NotBeNull();
|
||||
result.Value!.Id.Should().Be("file_abc123");
|
||||
result.Value.Filename.Should().Be("example.txt");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DownloadFileAsync_WhenCalled_ItShouldReturnFileContent()
|
||||
{
|
||||
var fileContent = "Hello World"u8.ToArray();
|
||||
|
||||
var httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
|
||||
{
|
||||
Content = new ByteArrayContent(fileContent)
|
||||
};
|
||||
httpResponseMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain");
|
||||
httpResponseMessage.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
|
||||
{
|
||||
FileName = "\"example.txt\""
|
||||
};
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenDownloadFileRequest("file_abc123")
|
||||
.Respond(_ => httpResponseMessage);
|
||||
|
||||
var result = await Client.DownloadFileAsync("file_abc123");
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().NotBeNull();
|
||||
result.Value!.Content.Should().BeEquivalentTo(fileContent);
|
||||
result.Value.Filename.Should().Be("example.txt");
|
||||
result.Value.ContentType.Should().Be("text/plain");
|
||||
result.Value.SizeBytes.Should().Be(fileContent.Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeleteFileAsync_WhenCalled_ItShouldReturnDeleteResponse()
|
||||
{
|
||||
var deleteResponseJson = @"{
|
||||
""type"": ""file_deleted"",
|
||||
""id"": ""file_abc123"",
|
||||
""deleted"": true
|
||||
}";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenDeleteFileRequest("file_abc123")
|
||||
.Respond(HttpStatusCode.OK, "application/json", deleteResponseJson);
|
||||
|
||||
var result = await Client.DeleteFileAsync("file_abc123");
|
||||
|
||||
result.IsSuccess.Should().BeTrue();
|
||||
result.Value.Should().NotBeNull();
|
||||
result.Value!.Id.Should().Be("file_abc123");
|
||||
result.Value.Deleted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateFileAsync_WhenCalledAndErrorReturned_ItShouldHandleError()
|
||||
{
|
||||
var errorJson = @"{
|
||||
""type"": ""error"",
|
||||
""error"": {
|
||||
""type"": ""invalid_request_error"",
|
||||
""message"": ""File too large""
|
||||
}
|
||||
}";
|
||||
|
||||
_mockHttpMessageHandler
|
||||
.WhenCreateFileRequest()
|
||||
.Respond(HttpStatusCode.BadRequest, "application/json", errorJson);
|
||||
|
||||
var content = "Hello World"u8.ToArray();
|
||||
var request = new FileRequest(content, "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>();
|
||||
}
|
||||
}
|
||||
@@ -1928,476 +1928,4 @@ 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>();
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public static class MockHttpMessageHandlerExtensions
|
||||
.SetupBaseRequest(HttpMethod.Get, $"{FilesEndpoint}/{fileId}");
|
||||
}
|
||||
|
||||
public static MockedRequest WhenGetFileContentRequest(this MockHttpMessageHandler mockHttpMessageHandler, string fileId)
|
||||
public static MockedRequest WhenDownloadFileRequest(this MockHttpMessageHandler mockHttpMessageHandler, string fileId)
|
||||
{
|
||||
return mockHttpMessageHandler
|
||||
.SetupBaseRequest(HttpMethod.Get, $"{FilesEndpoint}/{fileId}/content");
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -2,94 +2,66 @@ namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class AnthropicFileTests : SerializationTest
|
||||
{
|
||||
private readonly string _testJson = @"{
|
||||
""id"": ""file-123"",
|
||||
private const string SampleJson = @"{
|
||||
""type"": ""file"",
|
||||
""filename"": ""test.txt"",
|
||||
""created_at"": ""2023-10-01T00:00:00Z"",
|
||||
""id"": ""file_abc123"",
|
||||
""filename"": ""example.txt"",
|
||||
""content_type"": ""text/plain"",
|
||||
""size_bytes"": 1024,
|
||||
""mime_type"": ""text/plain"",
|
||||
""downloadable"": true
|
||||
""created_at"": ""2024-03-15T10:30:00Z""
|
||||
}";
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldInitializeProperties()
|
||||
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||
{
|
||||
var result = new AnthropicFile();
|
||||
var file = 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);
|
||||
file.Id.Should().BeEmpty();
|
||||
file.Filename.Should().BeEmpty();
|
||||
file.ContentType.Should().BeEmpty();
|
||||
file.SizeBytes.Should().Be(0);
|
||||
file.CreatedAt.Should().Be(default);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||
{
|
||||
var file = Deserialize<AnthropicFile>(_testJson);
|
||||
var result = Deserialize<AnthropicFile>(SampleJson);
|
||||
|
||||
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();
|
||||
result.Should().NotBeNull();
|
||||
result!.Type.Should().Be("file");
|
||||
result.Id.Should().Be("file_abc123");
|
||||
result.Filename.Should().Be("example.txt");
|
||||
result.ContentType.Should().Be("text/plain");
|
||||
result.SizeBytes.Should().Be(1024);
|
||||
result.CreatedAt.Should().Be(new DateTimeOffset(2024, 3, 15, 10, 30, 0, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonSerialization_WhenSerialized_ItShouldReturnExpectedShape()
|
||||
{
|
||||
var file = new AnthropicFile
|
||||
{
|
||||
Type = "file",
|
||||
Id = "file_abc123",
|
||||
Filename = "example.txt",
|
||||
ContentType = "text/plain",
|
||||
SizeBytes = 1024,
|
||||
CreatedAt = new DateTimeOffset(2024, 3, 15, 10, 30, 0, TimeSpan.Zero)
|
||||
};
|
||||
|
||||
var result = Serialize(file);
|
||||
|
||||
var expectedJson = @"{
|
||||
""type"": ""file"",
|
||||
""id"": ""file_abc123"",
|
||||
""filename"": ""example.txt"",
|
||||
""content_type"": ""text/plain"",
|
||||
""size_bytes"": 1024,
|
||||
""created_at"": ""2024-03-15T10:30:00+00:00""
|
||||
}";
|
||||
|
||||
JsonAssert.Equal(expectedJson, result);
|
||||
}
|
||||
}
|
||||
@@ -131,64 +131,4 @@ 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);
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
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,52 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class FileDeleteResponseTests : SerializationTest
|
||||
{
|
||||
private const string SampleJson = @"{
|
||||
""type"": ""file_deleted"",
|
||||
""id"": ""file_abc123"",
|
||||
""deleted"": true
|
||||
}";
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||
{
|
||||
var response = new FileDeleteResponse();
|
||||
|
||||
response.Type.Should().Be("file_deleted");
|
||||
response.Id.Should().BeEmpty();
|
||||
response.Deleted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedValues()
|
||||
{
|
||||
var result = Deserialize<FileDeleteResponse>(SampleJson);
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result!.Type.Should().Be("file_deleted");
|
||||
result.Id.Should().Be("file_abc123");
|
||||
result.Deleted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonSerialization_WhenSerialized_ItShouldReturnExpectedShape()
|
||||
{
|
||||
var response = new FileDeleteResponse
|
||||
{
|
||||
Type = "file_deleted",
|
||||
Id = "file_abc123",
|
||||
Deleted = true
|
||||
};
|
||||
|
||||
var result = Serialize(response);
|
||||
|
||||
var expectedJson = @"{
|
||||
""type"": ""file_deleted"",
|
||||
""id"": ""file_abc123"",
|
||||
""deleted"": true
|
||||
}";
|
||||
|
||||
JsonAssert.Equal(expectedJson, result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class FileDownloadResponseTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
var filename = "example.txt";
|
||||
var contentType = "text/plain";
|
||||
var sizeBytes = 1024;
|
||||
|
||||
var response = new FileDownloadResponse(content, filename, contentType, sizeBytes);
|
||||
|
||||
response.Content.Should().BeEquivalentTo(content);
|
||||
response.Filename.Should().Be(filename);
|
||||
response.ContentType.Should().Be(contentType);
|
||||
response.SizeBytes.Should().Be(sizeBytes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class FileRequestTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldReturnAnInstanceWithPropertiesSet()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
var filename = "example.txt";
|
||||
var contentType = "text/plain";
|
||||
var purpose = "user_upload";
|
||||
|
||||
var request = new FileRequest(content, filename, contentType, purpose);
|
||||
|
||||
request.Content.Should().BeEquivalentTo(content);
|
||||
request.Filename.Should().Be(filename);
|
||||
request.ContentType.Should().Be(contentType);
|
||||
request.Purpose.Should().Be(purpose);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithDefaultPurpose_ItShouldSetPurposeToUserUpload()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
var filename = "example.txt";
|
||||
var contentType = "text/plain";
|
||||
|
||||
var request = new FileRequest(content, filename, contentType);
|
||||
|
||||
request.Content.Should().BeEquivalentTo(content);
|
||||
request.Filename.Should().Be(filename);
|
||||
request.ContentType.Should().Be(contentType);
|
||||
request.Purpose.Should().Be("user_upload");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenContentIsNull_ItShouldThrowArgumentNullException()
|
||||
{
|
||||
var act = () => new FileRequest(null!, "example.txt", "text/plain");
|
||||
|
||||
act.Should().Throw<ArgumentNullException>().WithParameterName("content");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenFilenameIsNull_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, null!, "text/plain");
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("filename");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenFilenameIsEmpty_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, "", "text/plain");
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("filename");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenContentTypeIsNull_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, "example.txt", null!);
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("contentType");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenContentTypeIsEmpty_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, "example.txt", "");
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("contentType");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenPurposeIsNull_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, "example.txt", "text/plain", null!);
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("purpose");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenPurposeIsEmpty_ItShouldThrowArgumentException()
|
||||
{
|
||||
var content = "Hello World"u8.ToArray();
|
||||
|
||||
var act = () => new FileRequest(content, "example.txt", "text/plain", "");
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithParameterName("purpose");
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
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_WhenCalledWithCacheControlAndMediaTypeIsNull_ItShouldThrowArgumentNullException()
|
||||
public void Constructor_WhenCalledWithCacheControlAndMediatTypeIsNull_ItShouldThrowArgumentNullException()
|
||||
{
|
||||
var expectedData = "data";
|
||||
var cacheControl = new EphemeralCacheControl();
|
||||
@@ -98,49 +98,6 @@ 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,10 +19,4 @@ public class SourceTypeTests
|
||||
{
|
||||
SourceType.Text.Should().Be("text");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void File_WhenCalled_ItShouldReturnCorrectValue()
|
||||
{
|
||||
SourceType.File.Should().Be("file");
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
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"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user