pub struct Client<E> { /* private fields */ }Expand description
A transport-neutral Restate ingress client.
Implementations§
Source§impl<E: RequestExecutor> Client<E>
impl<E: RequestExecutor> Client<E>
Sourcepub fn new(base_uri: Uri, executor: E) -> Result<Self, ClientBuildError>
pub fn new(base_uri: Uri, executor: E) -> Result<Self, ClientBuildError>
Creates a client with no default headers.
Sourcepub fn builder(base_uri: Uri, executor: E) -> ClientBuilder<E>
pub fn builder(base_uri: Uri, executor: E) -> ClientBuilder<E>
Creates a client builder.
Sourcepub fn with_restate_auth_token(
self,
token: impl AsRef<str>,
) -> Result<Self, ClientBuildError>
pub fn with_restate_auth_token( self, token: impl AsRef<str>, ) -> Result<Self, ClientBuildError>
Adds a raw Restate Cloud authentication token to every request.
This method prepends Bearer and installs the resulting Authorization header as a
default. An Authorization header set on an individual request overrides it.
§Errors
Returns ClientBuildError::InvalidAuthToken when the token cannot be represented in an
HTTP header.
Sourcepub fn request<Req, Res>(
&self,
target: RequestTarget,
input: Req,
) -> Request<E, Req, Res>
pub fn request<Req, Res>( &self, target: RequestTarget, input: Req, ) -> Request<E, Req, Res>
Creates a typed request for a service handler.
Sourcepub fn invocation_handle<Res>(
&self,
invocation_id: impl Into<InvocationId>,
) -> InvocationHandle<E, Res>
pub fn invocation_handle<Res>( &self, invocation_id: impl Into<InvocationId>, ) -> InvocationHandle<E, Res>
Creates a typed handle for a persisted or externally obtained invocation ID.
Sourcepub async fn lookup_workflow<Res>(
&self,
workflow_name: impl Into<String>,
workflow_key: impl Into<String>,
scope: Option<String>,
) -> Result<InvocationHandle<E, Res>, ClientError>
pub async fn lookup_workflow<Res>( &self, workflow_name: impl Into<String>, workflow_key: impl Into<String>, scope: Option<String>, ) -> Result<InvocationHandle<E, Res>, ClientError>
Looks up the invocation handle for a workflow by name and key.
scope optionally restricts the lookup to a Restate Cloud scope; pass None outside Cloud.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Client<E>
impl<E> RefUnwindSafe for Client<E>where
Arc<ClientState<E>>: RefUnwindSafe,
impl<E> Send for Client<E>
impl<E> Sync for Client<E>
impl<E> Unpin for Client<E>
impl<E> UnsafeUnpin for Client<E>where
Arc<ClientState<E>>: UnsafeUnpin,
impl<E> UnwindSafe for Client<E>where
Arc<ClientState<E>>: UnwindSafe,
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
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> ⓘ
Converts
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> ⓘ
Converts
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