pub struct ApiKeyHandler { /* private fields */ }
Expand description
Handler for API key operations
Implementations§
Source§impl ApiKeyHandler
impl ApiKeyHandler
Sourcepub fn new(client: FilesClient) -> Self
pub fn new(client: FilesClient) -> Self
Creates a new ApiKeyHandler
Sourcepub async fn list(
&self,
user_id: Option<i64>,
cursor: Option<String>,
per_page: Option<i32>,
) -> Result<(Vec<ApiKeyEntity>, PaginationInfo)>
pub async fn list( &self, user_id: Option<i64>, cursor: Option<String>, per_page: Option<i32>, ) -> Result<(Vec<ApiKeyEntity>, PaginationInfo)>
List API keys
§Arguments
user_id
- Filter by user ID (optional)cursor
- Pagination cursor (optional)per_page
- Results per page (optional)
§Examples
let handler = ApiKeyHandler::new(client);
let (keys, pagination) = handler.list(None, None, Some(10)).await?;
for key in keys {
println!("API Key: {:?}", key.name);
}
Sourcepub async fn get(&self, id: i64) -> Result<ApiKeyEntity>
pub async fn get(&self, id: i64) -> Result<ApiKeyEntity>
Sourcepub async fn create(
&self,
name: Option<&str>,
description: Option<&str>,
expires_at: Option<&str>,
permission_set: Option<&str>,
) -> Result<ApiKeyEntity>
pub async fn create( &self, name: Option<&str>, description: Option<&str>, expires_at: Option<&str>, permission_set: Option<&str>, ) -> Result<ApiKeyEntity>
Create a new API key
§Arguments
name
- Name for the API key (optional)description
- Description (optional)expires_at
- Expiration timestamp (optional)permission_set
- Permission set name (optional)
§Examples
let handler = ApiKeyHandler::new(client);
let key = handler.create(
Some("My API Key"),
Some("For automated uploads"),
None,
None
).await?;
println!("Created key: {:?}", key.key);
Trait Implementations§
Source§impl Clone for ApiKeyHandler
impl Clone for ApiKeyHandler
Source§fn clone(&self) -> ApiKeyHandler
fn clone(&self) -> ApiKeyHandler
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 ApiKeyHandler
impl !RefUnwindSafe for ApiKeyHandler
impl Send for ApiKeyHandler
impl Sync for ApiKeyHandler
impl Unpin for ApiKeyHandler
impl !UnwindSafe for ApiKeyHandler
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