pub struct ClientBuilder { /* private fields */ }async only.Expand description
Builder for Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Override the base URL. Useful for proxies and wiremock-based tests.
Defaults to https://api.anthropic.com.
Sourcepub fn beta(self, header_value: impl Into<String>) -> Self
pub fn beta(self, header_value: impl Into<String>) -> Self
Append an anthropic-beta value. May be called multiple times; values
are comma-joined per Anthropic convention.
Sourcepub fn timeout(self, d: Duration) -> Self
pub fn timeout(self, d: Duration) -> Self
Per-request timeout applied to the underlying reqwest client.
Ignored if a custom HTTP client is supplied via Self::http_client.
Sourcepub fn retry(self, policy: RetryPolicy) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
Override the default retry policy.
Sourcepub fn http_client(self, c: Client) -> Self
pub fn http_client(self, c: Client) -> Self
Supply your own reqwest::Client. Lets callers reuse a connection
pool, install custom middleware, or configure proxy / TLS settings
outside the SDK.
Sourcepub fn user_agent(self, ua: impl Into<String>) -> Self
pub fn user_agent(self, ua: impl Into<String>) -> Self
Override the User-Agent header. Defaults to claude-api-rs/<version>.
Sourcepub fn signer(self, signer: Arc<dyn RequestSigner>) -> Self
pub fn signer(self, signer: Arc<dyn RequestSigner>) -> Self
Install a custom RequestSigner. If unset, the builder
defaults to ApiKeySigner from the configured api_key.
Setting both is allowed: the explicit signer takes precedence
(useful for tests that want a no-op signer with an unused
placeholder key).
Trait Implementations§
Source§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Source§impl Default for ClientBuilder
impl Default for ClientBuilder
Source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more