pub struct Client { /* private fields */ }Expand description
HTTP client that interacts with the Tensorlake Cloud API.
Implementations§
Source§impl Client
impl Client
Sourcepub fn request_timeout(&self) -> Option<Duration>
pub fn request_timeout(&self) -> Option<Duration>
Total request timeout configured for this client, if any.
Sourcepub fn with_base_url(&self, new_url: &str) -> Self
pub fn with_base_url(&self, new_url: &str) -> Self
Create a new client that shares the same underlying HTTP connection pool but uses a
different base URL. Cloning reqwest::Client shares its Arc-backed connection pool, so
HTTP/2 connections established for one base URL can be reused (via connection coalescing)
when talking to another host that resolves to the same IP with the same TLS certificate.
Sourcepub fn with_base_url_without_timeout(
&self,
new_url: &str,
) -> Result<Self, SdkError>
pub fn with_base_url_without_timeout( &self, new_url: &str, ) -> Result<Self, SdkError>
Create a new client for a different base URL without a request timeout.
Sourcepub fn with_base_url_and_timeout(
&self,
new_url: &str,
timeout: Option<Duration>,
) -> Result<Self, SdkError>
pub fn with_base_url_and_timeout( &self, new_url: &str, timeout: Option<Duration>, ) -> Result<Self, SdkError>
Create a new client for a different base URL with an explicit total request timeout.
Sourcepub async fn execute(&self, request: Request) -> Result<Response, SdkError>
pub async fn execute(&self, request: Request) -> Result<Response, SdkError>
Execute an HTTP request. Injects a W3C traceparent header for server-side
correlation. Use [execute_traced] or [execute_json] when you need the
trace_id returned to the caller.
Sourcepub async fn execute_raw(&self, request: Request) -> Result<Response, SdkError>
pub async fn execute_raw(&self, request: Request) -> Result<Response, SdkError>
Execute an HTTP request without mapping non-success statuses to SdkError.
Injects a W3C traceparent header for server-side correlation.
Sourcepub async fn execute_raw_traced(
&self,
request: Request,
) -> Result<Traced<Response>, SdkError>
pub async fn execute_raw_traced( &self, request: Request, ) -> Result<Traced<Response>, SdkError>
Execute a traced request while leaving status handling to the binding. Useful for APIs with expected non-success statuses (such as lookup 404s).
Sourcepub async fn execute_traced(
&self,
request: Request,
) -> Result<Traced<Response>, SdkError>
pub async fn execute_traced( &self, request: Request, ) -> Result<Traced<Response>, SdkError>
Execute an HTTP request, inject a W3C traceparent header, and return
the raw response alongside the trace_id. Use this when you need the
trace_id but want to handle the response body yourself.
Sourcepub async fn execute_json<T: DeserializeOwned>(
&self,
request: Request,
) -> Result<Traced<T>, SdkError>
pub async fn execute_json<T: DeserializeOwned>( &self, request: Request, ) -> Result<Traced<T>, SdkError>
Execute an HTTP request, inject a W3C traceparent header, deserialize
the JSON response body, and return both alongside the trace_id.
This is the primary building block for service-level methods that return
structured responses. The trace_id lets callers look up the full
server-side cascade in Datadog APM.
Sourcepub async fn execute_json_allow_status<T: DeserializeOwned>(
&self,
request: Request,
allowed_statuses: &[StatusCode],
) -> Result<Traced<T>, SdkError>
pub async fn execute_json_allow_status<T: DeserializeOwned>( &self, request: Request, allowed_statuses: &[StatusCode], ) -> Result<Traced<T>, SdkError>
Execute an HTTP request and deserialize JSON if the status is success or
explicitly listed in allowed_statuses.
pub fn request(&self, method: Method, path: &str) -> RequestBuilder
pub async fn build_event_source_request<T>(
&self,
path: &str,
) -> Result<Traced<Pin<Box<dyn Stream<Item = Result<T, SdkError>> + Send>>>, SdkError>where
T: DeserializeOwned,
pub fn build_multipart_request( &self, method: Method, path: &str, form: Form, ) -> Result<Request, SdkError>
pub fn build_empty_post_request(&self, path: &str) -> Result<Request, SdkError>
pub fn build_bytes_post_request( &self, path: &str, body: Vec<u8>, ) -> Result<Request, SdkError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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