pub struct ClientBuilder { /* private fields */ }Expand description
Builder for creating a Client with a fluent API.
The base URL is required, while bearer token, middlewares, and scope are optional.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(base_url: &str) -> Self
pub fn new(base_url: &str) -> Self
Create a new ClientBuilder with the specified base URL.
§Arguments
base_url- The base URL of the API
Sourcepub fn user_agent(self, ua: &str) -> Self
pub fn user_agent(self, ua: &str) -> Self
Override the User-Agent header sent with every request.
Defaults to tensorlake-rust-sdk/{CARGO_PKG_VERSION}. Callers that
wrap this client (e.g. the Python SDK via PyO3) should set a value like
tensorlake-python-sdk/{version} so server logs can distinguish traffic
by SDK language.
Sourcepub fn bearer_token(self, token: &str) -> Self
pub fn bearer_token(self, token: &str) -> Self
Set the bearer token for authentication.
Sourcepub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware + 'static,
pub fn middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware + 'static,
Add middleware to the client.
Sourcepub fn middlewares(
self,
middlewares: Vec<Arc<dyn Middleware + 'static>>,
) -> Self
pub fn middlewares( self, middlewares: Vec<Arc<dyn Middleware + 'static>>, ) -> Self
Add multiple middlewares to the client.
Auto Trait Implementations§
impl !RefUnwindSafe for ClientBuilder
impl !UnwindSafe for ClientBuilder
impl Freeze for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin 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