pub struct ApiClientBuilder { /* private fields */ }Expand description
Builder for creating API clients with custom configuration
Implementations§
Source§impl ApiClientBuilder
impl ApiClientBuilder
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a new builder with the specified base URL
Sourcepub fn environment(self, environment: Environment) -> Self
pub fn environment(self, environment: Environment) -> Self
Set the environment, updating the base URL
Sourcepub fn username(self, username: impl Into<String>) -> Self
pub fn username(self, username: impl Into<String>) -> Self
Set the username for basic authentication
Sourcepub fn password(self, password: impl Into<String>) -> Self
pub fn password(self, password: impl Into<String>) -> Self
Set the password for basic authentication
Sourcepub fn client_id(self, client_id: impl Into<String>) -> Self
pub fn client_id(self, client_id: impl Into<String>) -> Self
Set the OAuth client ID for client credentials authentication
Sourcepub fn client_secret(self, client_secret: impl Into<String>) -> Self
pub fn client_secret(self, client_secret: impl Into<String>) -> Self
Set the OAuth client secret for client credentials authentication
Sourcepub fn oauth_credentials(
self,
client_id: impl Into<String>,
client_secret: impl Into<String>,
) -> Self
pub fn oauth_credentials( self, client_id: impl Into<String>, client_secret: impl Into<String>, ) -> Self
Set OAuth credentials (client_id and client_secret) for client credentials authentication
Sourcepub fn max_retries(self, retries: u32) -> Self
pub fn max_retries(self, retries: u32) -> Self
Set the maximum number of retries
Sourcepub fn custom_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn custom_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom header
Sourcepub fn custom_headers(self, headers: HashMap<String, String>) -> Self
pub fn custom_headers(self, headers: HashMap<String, String>) -> Self
Add multiple custom headers
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Set the user agent
Sourcepub fn reqwest_client(self, client: Client) -> Self
pub fn reqwest_client(self, client: Client) -> Self
Use a custom reqwest client for every request
The supplied client is used as-is, so it owns all transport-level configuration — custom certificates, proxies, timeouts and user agent. Authentication, custom headers and retries are still applied by the SDK.
Sourcepub fn build(self) -> Result<BrevoClient, ApiError>
pub fn build(self) -> Result<BrevoClient, ApiError>
Build the client with validation