Files
anthropic-client/docs/api/AnthropicClient.AnthropicApiClient.html
T

780 lines
38 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class AnthropicApiClient | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class AnthropicApiClient | AnthropicClient ">
<meta name="description" content="Represents a client for interacting with 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_AnthropicApiClient.md&amp;value=---%0Auid%3A%20AnthropicClient.AnthropicApiClient%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.AnthropicApiClient">
<h1 id="AnthropicClient_AnthropicApiClient" data-uid="AnthropicClient.AnthropicApiClient" class="text-break">
Class AnthropicApiClient <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L13"><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></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a client for interacting with the Anthropic API.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class AnthropicApiClient : IAnthropicApiClient</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">AnthropicApiClient</span></div>
</dd>
</dl>
<dl class="typelist implements">
<dt>Implements</dt>
<dd>
<div><a class="xref" href="AnthropicClient.IAnthropicApiClient.html">IAnthropicApiClient</a></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_AnthropicApiClient__ctor_" data-uid="AnthropicClient.AnthropicApiClient.#ctor*"></a>
<h3 id="AnthropicClient_AnthropicApiClient__ctor_System_String_System_Net_Http_HttpClient_" data-uid="AnthropicClient.AnthropicApiClient.#ctor(System.String,System.Net.Http.HttpClient)">
AnthropicApiClient(string, HttpClient)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L37"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="AnthropicClient.AnthropicApiClient.html">AnthropicApiClient</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public AnthropicApiClient(string apiKey, HttpClient httpClient)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>apiKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The API key to use for the client.</p>
</dd>
<dt><code>httpClient</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.net.http.httpclient">HttpClient</a></dt>
<dd><p>The HTTP client to use for the client.</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 API key or HTTP client is null.</p>
</dd>
</dl>
<h2 class="section" id="methods">Methods
</h2>
<a id="AnthropicClient_AnthropicApiClient_CancelMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.CancelMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CancelMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CancelMessageBatchAsync(System.String,System.Threading.CancellationToken)">
CancelMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L303"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Cancels a message batch asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;MessageBatchResponse&gt;&gt; CancelMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>batchId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the message batch to cancel.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_" data-uid="AnthropicClient.AnthropicApiClient.CountMessageTokensAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CountMessageTokensAsync_AnthropicClient_Models_CountMessageTokensRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CountMessageTokensAsync(AnthropicClient.Models.CountMessageTokensRequest,System.Threading.CancellationToken)">
CountMessageTokensAsync(CountMessageTokensRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L351"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Counts the tokens in a message asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;TokenCountResponse&gt;&gt; CountMessageTokensAsync(CountMessageTokensRequest 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.CountMessageTokensRequest.html">CountMessageTokensRequest</a></dt>
<dd><p>The count message tokens request.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.TokenCountResponse.html">TokenCountResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_MessageRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.MessageRequest,System.Threading.CancellationToken)">
CreateMessageAsync(MessageRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L56"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a message asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;MessageResponse&gt;&gt; CreateMessageAsync(MessageRequest 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.MessageRequest.html">MessageRequest</a></dt>
<dd><p>The message request to create.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageResponse.html">MessageResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageAsync_AnthropicClient_Models_StreamMessageRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageAsync(AnthropicClient.Models.StreamMessageRequest,System.Threading.CancellationToken)">
CreateMessageAsync(StreamMessageRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L79"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a message asynchronously and streams the response.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IAsyncEnumerable&lt;AnthropicEvent&gt; CreateMessageAsync(StreamMessageRequest 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.StreamMessageRequest.html">StreamMessageRequest</a></dt>
<dd><p>The message request to create.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicEvent.html">AnthropicEvent</a>&gt;</dt>
<dd><p>An asynchronous enumerable that yields the response event by event.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_CreateMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_CreateMessageBatchAsync_AnthropicClient_Models_MessageBatchRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.CreateMessageBatchAsync(AnthropicClient.Models.MessageBatchRequest,System.Threading.CancellationToken)">
CreateMessageBatchAsync(MessageBatchRequest, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L271"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a batch of messages asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;MessageBatchResponse&gt;&gt; CreateMessageBatchAsync(MessageBatchRequest 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.MessageBatchRequest.html">MessageBatchRequest</a></dt>
<dd><p>The message batch request to create.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_DeleteMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_DeleteMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.DeleteMessageBatchAsync(System.String,System.Threading.CancellationToken)">
DeleteMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L311"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Deletes a message batch asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;MessageBatchDeleteResponse&gt;&gt; DeleteMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>batchId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the message batch to delete.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchDeleteResponse.html">MessageBatchDeleteResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchDeleteResponse.html">MessageBatchDeleteResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_GetMessageBatchAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetMessageBatchAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchAsync(System.String,System.Threading.CancellationToken)">
GetMessageBatchAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L278"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a message batch asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;MessageBatchResponse&gt;&gt; GetMessageBatchAsync(string batchId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>batchId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the message batch to get.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_GetMessageBatchResultsAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchResultsAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetMessageBatchResultsAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetMessageBatchResultsAsync(System.String,System.Threading.CancellationToken)">
GetMessageBatchResultsAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L319"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the results of a message batch asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;IAsyncEnumerable&lt;MessageBatchResultItem&gt;&gt;&gt; GetMessageBatchResultsAsync(string batchId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>batchId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the message batch to get the results for.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResultItem.html">MessageBatchResultItem</a>&gt;&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResultItem.html">MessageBatchResultItem</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_GetModelAsync_" data-uid="AnthropicClient.AnthropicApiClient.GetModelAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_GetModelAsync_System_String_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.GetModelAsync(System.String,System.Threading.CancellationToken)">
GetModelAsync(string, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L376"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets a model by its ID asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;AnthropicModel&gt;&gt; GetModelAsync(string modelId, CancellationToken cancellationToken = default)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>modelId</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The ID of the model to get.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListAllMessageBatchesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListAllMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListAllMessageBatchesAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListAllMessageBatchesAsync(System.Int32,System.Threading.CancellationToken)">
ListAllMessageBatchesAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L294"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all message batches asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IAsyncEnumerable&lt;AnthropicResult&lt;Page&lt;MessageBatchResponse&gt;&gt;&gt; ListAllMessageBatchesAsync(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 message batches to return in each page.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>&gt;&gt;&gt;</dt>
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListAllModelsAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListAllModelsAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListAllModelsAsync_System_Int32_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListAllModelsAsync(System.Int32,System.Threading.CancellationToken)">
ListAllModelsAsync(int, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L367"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists all models asynchronously, returning every page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public IAsyncEnumerable&lt;AnthropicResult&lt;Page&lt;AnthropicModel&gt;&gt;&gt; ListAllModelsAsync(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 models to return in each page.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1">IAsyncEnumerable</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>&gt;&gt;&gt;</dt>
<dd><p>An asynchronous enumerable that yields the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListMessageBatchesAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListMessageBatchesAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListMessageBatchesAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListMessageBatchesAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListMessageBatchesAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L285"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists the message batches asynchronously.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;Page&lt;MessageBatchResponse&gt;&gt;&gt; ListMessageBatchesAsync(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 message batches.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>&gt;&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.MessageBatchResponse.html">MessageBatchResponse</a>.</p>
</dd>
</dl>
<a id="AnthropicClient_AnthropicApiClient_ListModelsAsync_" data-uid="AnthropicClient.AnthropicApiClient.ListModelsAsync*"></a>
<h3 id="AnthropicClient_AnthropicApiClient_ListModelsAsync_AnthropicClient_Models_PagingRequest_System_Threading_CancellationToken_" data-uid="AnthropicClient.AnthropicApiClient.ListModelsAsync(AnthropicClient.Models.PagingRequest,System.Threading.CancellationToken)">
ListModelsAsync(PagingRequest?, CancellationToken)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L358"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Lists models asynchronously, returning a single page of results.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;AnthropicResult&lt;Page&lt;AnthropicModel&gt;&gt;&gt; ListModelsAsync(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 models.</p>
</dd>
<dt><code>cancellationToken</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></dt>
<dd><p>A token to cancel the asynchronous operation.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;<a class="xref" href="AnthropicResult-1.html">AnthropicResult</a>&lt;<a class="xref" href="AnthropicClient.Models.Page-1.html">Page</a>&lt;<a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>&gt;&gt;&gt;</dt>
<dd><p>A task that represents the asynchronous operation. The task result contains the response as an <a class="xref" href="AnthropicResult-1.html">AnthropicResult&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.Page-1.html">Page&lt;T&gt;</a> where T is <a class="xref" href="AnthropicClient.Models.AnthropicModel.html">AnthropicModel</a>.</p>
</dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/main/src/AnthropicClient/AnthropicApiClient.cs/#L13" 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>