pub struct ClientConfig { /* private fields */ }Expand description
Configuration builder for creating a Client.
Supports two authentication modes:
- Bearer token: JWT authentication via
with_token - Basic auth: username/password via
with_basic_auth
§Examples
use android_sms_gateway::ClientConfig;
// JWT authentication
let config = ClientConfig::new()
.with_token("your-jwt-token");
// Basic authentication
let config = ClientConfig::new()
.with_basic_auth("username", "password");Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new configuration with default values.
The default base URL is https://api.sms-gate.app/3rdparty/v1.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Sets a custom base URL for the API.
Useful for private server deployments.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Configures JWT bearer token authentication.
Sourcepub fn with_basic_auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn with_basic_auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Configures HTTP Basic authentication.
Sourcepub fn with_http_client(self, client: Client) -> Self
pub fn with_http_client(self, client: Client) -> Self
Provides a custom reqwest::Client for advanced HTTP configuration.
By default, a client with default settings is used.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ClientConfig
impl !UnwindSafe for ClientConfig
impl Freeze for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
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
Mutably borrows from an owned value. Read more