pub struct AuthClient { /* private fields */ }Expand description
Async client for customer token operations.
Implementations§
Source§impl AuthClient
impl AuthClient
Sourcepub async fn customer_token(
&self,
req: CustomerTokenRequest,
) -> Result<CustomerToken, Error>
pub async fn customer_token( &self, req: CustomerTokenRequest, ) -> Result<CustomerToken, Error>
Mint a customer-scoped bearer token (requires secret key auth).
Sourcepub async fn get_or_create_customer_token(
&self,
req: GetOrCreateCustomerTokenRequest,
) -> Result<CustomerToken, Error>
pub async fn get_or_create_customer_token( &self, req: GetOrCreateCustomerTokenRequest, ) -> Result<CustomerToken, Error>
Get or create a customer and mint a bearer token.
This is a convenience method that:
- Upserts the customer (creates if not exists)
- Mints a customer-scoped bearer token
Use this when you want to ensure the customer exists before minting a token,
without needing to handle 404 errors from customer_token().
Requires a secret key.
Trait Implementations§
Source§impl Clone for AuthClient
impl Clone for AuthClient
Source§fn clone(&self) -> AuthClient
fn clone(&self) -> AuthClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthClient
impl !RefUnwindSafe for AuthClient
impl Send for AuthClient
impl Sync for AuthClient
impl Unpin for AuthClient
impl !UnwindSafe for AuthClient
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