pub struct ClientBuilder(/* private fields */);Expand description
Builder to create a Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new(service_url: impl IntoUrl) -> Self
pub fn new(service_url: impl IntoUrl) -> Self
Creates a new ClientBuilder, configured with the given service_url.
To perform CRUD operations, one has to create a Client, and then scope it to a Usecase
and Scope in order to create a Session.
Sourcepub fn propagate_traces(self, propagate_traces: bool) -> Self
pub fn propagate_traces(self, propagate_traces: bool) -> Self
Changes whether the sentry-trace header will be sent to Objectstore
to take advantage of Sentry’s distributed tracing.
By default, tracing headers will not be propagated.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Defines a read timeout for the [reqwest::Client].
The read timeout is defined to be “between consecutive read operations”, for example between
chunks of a streaming response. For more fine-grained configuration of this and other
timeouts, use Self::configure_reqwest.
By default, no read timeout and a connect timeout of 100ms is set.
Sourcepub fn configure_reqwest<F>(self, closure: F) -> Selfwhere
F: FnOnce(ClientBuilder) -> ClientBuilder,
pub fn configure_reqwest<F>(self, closure: F) -> Selfwhere
F: FnOnce(ClientBuilder) -> ClientBuilder,
Calls the closure with the underlying [reqwest::ClientBuilder].
By default, the ClientBuilder is configured to create a reqwest Client with a connect and read timeout of 500ms and a user agent identifying this library.
Sourcepub fn token(self, token: impl Into<TokenProvider>) -> Self
pub fn token(self, token: impl Into<TokenProvider>) -> Self
Sets the authentication token to use for requests to Objectstore.
Accepts anything that implements Into<TokenProvider>:
- A
TokenGenerator— for internal services that have access to an EdDSA keypair. The generator signs a fresh JWT for each request. - A
Stringor&str— a pre-signed JWT, used as-is for every request.
Sourcepub fn build(self) -> Result<Client>
pub fn build(self) -> Result<Client>
Returns a Client that uses this ClientBuilder configuration.
§Errors
This method fails if:
- the given
service_urlis invalid or cannot be used as a base URL - the [
reqwest::Client] fails to build. Refer to [reqwest::ClientBuilder::build] for more information on when this can happen.
Trait Implementations§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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