pub struct ApiKeysApi<'a, A> { /* private fields */ }Expand description
Calls the API key endpoints without HTTP, as the server: server-only fields are accepted,
and user_id names the owner when no session is passed with headers.
Implementations§
Source§impl<A: AuthInstance> ApiKeysApi<'_, A>
impl<A: AuthInstance> ApiKeysApi<'_, A>
Sourcepub fn headers(self, headers: &HeaderMap) -> Self
pub fn headers(self, headers: &HeaderMap) -> Self
Acts for the session in these request headers. A user_id in an input must then
name the same user.
Sourcepub async fn create(
&self,
input: CreateApiKeyInput,
) -> Result<CreatedApiKey, AuthError>
pub async fn create( &self, input: CreateApiKeyInput, ) -> Result<CreatedApiKey, AuthError>
Creates a key. The response’s key is the only copy of it.
Sourcepub async fn verify(
&self,
key: &str,
permissions: Option<Permissions>,
) -> Result<VerifyOutput, AuthError>
pub async fn verify( &self, key: &str, permissions: Option<Permissions>, ) -> Result<VerifyOutput, AuthError>
Verifies key and counts the use against its limits. A refused key is
Ok with valid: false and the error; Err is for failures unrelated to the key.
Sourcepub async fn get(&self, input: GetApiKeyInput) -> Result<ApiKeyView, AuthError>
pub async fn get(&self, input: GetApiKeyInput) -> Result<ApiKeyView, AuthError>
One key of its owner.
Sourcepub async fn update(
&self,
input: UpdateApiKeyInput,
) -> Result<ApiKeyView, AuthError>
pub async fn update( &self, input: UpdateApiKeyInput, ) -> Result<ApiKeyView, AuthError>
Changes a key.
Sourcepub async fn delete(
&self,
input: DeleteApiKeyInput,
) -> Result<Success, AuthError>
pub async fn delete( &self, input: DeleteApiKeyInput, ) -> Result<Success, AuthError>
Deletes a key.
Sourcepub async fn list(
&self,
input: ListApiKeysInput,
) -> Result<ApiKeyList, AuthError>
pub async fn list( &self, input: ListApiKeysInput, ) -> Result<ApiKeyList, AuthError>
The keys of one owner.
Sourcepub async fn delete_all_expired(&self) -> Result<DeleteExpiredOutput, AuthError>
pub async fn delete_all_expired(&self) -> Result<DeleteExpiredOutput, AuthError>
Deletes every expired key.
Trait Implementations§
Auto Trait Implementations§
impl<'a, A> !RefUnwindSafe for ApiKeysApi<'a, A>
impl<'a, A> !UnwindSafe for ApiKeysApi<'a, A>
impl<'a, A> Forget for ApiKeysApi<'a, A>
impl<'a, A> Freeze for ApiKeysApi<'a, A>
impl<'a, A> Move for ApiKeysApi<'a, A>
impl<'a, A> Send for ApiKeysApi<'a, A>
impl<'a, A> Sync for ApiKeysApi<'a, A>
impl<'a, A> Unpin for ApiKeysApi<'a, A>
impl<'a, A> UnsafeUnpin for ApiKeysApi<'a, A>where
&'a A: UnsafeUnpin,
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