pub struct ClientBuilder { /* private fields */ }
Expand description
Builder for configuring and creating a Client
instance.
The ClientBuilder
provides a fluent interface for setting optional parameters,
allowing customization of project_id
, version_id
, and base_url
. Once all
desired parameters are set, call build
to create a Client
instance.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn project_id(self, project_id: u64) -> Self
pub fn project_id(self, project_id: u64) -> Self
Sourcepub fn version_id(self, version_id: String) -> Self
pub fn version_id(self, version_id: String) -> Self
Sets the version_id
for the Client
.
This version_id
represents the version of the project or document and
will be used in API requests.
§Arguments
version_id
- The UUID of the version.
§Example
use latitude_sdk::Client;
let client_builder = Client::builder("your_api_key".into())
.version_id("version-uuid".to_string());
Sourcepub fn base_url(self, base_url: String) -> Self
pub fn base_url(self, base_url: String) -> Self
Sets a custom base_url
for the API endpoint.
This is useful if the API endpoint changes or if using a mock server for testing purposes.
§Arguments
base_url
- The base URL of the API as a string.
§Example
use latitude_sdk::Client;
let client_builder = Client::builder("your_api_key".into())
.base_url("https://custom.url/api".to_string());
Sourcepub fn build(self) -> Client
pub fn build(self) -> Client
Builds and returns a new Client
instance.
After setting the necessary parameters, call build
to create the Client
.
Once built, the Client
can be used to interact with the Latitude API.
§Example
use latitude_sdk::Client;
let client = Client::builder("your_api_key".into())
.project_id(123)
.version_id("version-uuid".to_string())
.base_url("https://custom.url/api".to_string())
.build();
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin 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
Mutably borrows from an owned value. Read more