pub struct ClerkClient { /* private fields */ }Expand description
Entrypoint for interacting with the Clerk Backend API
Implementations§
Source§impl ClerkClient
impl ClerkClient
Sourcepub fn new<K>(secret_key: K) -> Result<Self>where
K: ToString,
pub fn new<K>(secret_key: K) -> Result<Self>where
K: ToString,
Create a new Clerk client struct. It takes a secret key (starts with sk_)
Sourcepub fn new_from_env() -> Result<Self>
pub fn new_from_env() -> Result<Self>
Create a new Clerk client struct from environment variables
Sourcepub async fn list_users(&self, params: ListUsersParams) -> Result<Vec<User>>
pub async fn list_users(&self, params: ListUsersParams) -> Result<Vec<User>>
List users GET /users
Sourcepub async fn get_user(&self, user_id: &str) -> Result<User>
pub async fn get_user(&self, user_id: &str) -> Result<User>
Get a user by ID GET /users/{user_id}
Sourcepub async fn create_user(&self, req: CreateUserRequest) -> Result<User>
pub async fn create_user(&self, req: CreateUserRequest) -> Result<User>
Create a new user POST /users
Sourcepub async fn update_user(
&self,
user_id: &str,
req: UpdateUserRequest,
) -> Result<User>
pub async fn update_user( &self, user_id: &str, req: UpdateUserRequest, ) -> Result<User>
Update a user PATCH /users/{user_id}
Sourcepub async fn delete_user(&self, user_id: &str) -> Result<DeletedObject>
pub async fn delete_user(&self, user_id: &str) -> Result<DeletedObject>
Delete a user DELETE /users/{user_id}
Sourcepub async fn list_sessions(
&self,
params: ListSessionsParams,
) -> Result<Vec<Session>>
pub async fn list_sessions( &self, params: ListSessionsParams, ) -> Result<Vec<Session>>
List sessions GET /sessions
Sourcepub async fn get_session(&self, session_id: &str) -> Result<Session>
pub async fn get_session(&self, session_id: &str) -> Result<Session>
Get a session by ID GET /sessions/{session_id}
Sourcepub async fn verify_session(&self, session_id: &str) -> Result<Session>
pub async fn verify_session(&self, session_id: &str) -> Result<Session>
Verify a session token POST /sessions/{session_id}/verify
Sourcepub async fn revoke_session(&self, session_id: &str) -> Result<Session>
pub async fn revoke_session(&self, session_id: &str) -> Result<Session>
Revoke a session POST /sessions/{session_id}/revoke
Sourcepub async fn list_organizations(
&self,
params: ListOrganizationsParams,
) -> Result<Vec<Organization>>
pub async fn list_organizations( &self, params: ListOrganizationsParams, ) -> Result<Vec<Organization>>
List organizations GET /organizations
Sourcepub async fn get_organization(
&self,
organization_id: &str,
) -> Result<Organization>
pub async fn get_organization( &self, organization_id: &str, ) -> Result<Organization>
Get an organization by ID GET /organizations/{organization_id}
Sourcepub async fn create_organization(
&self,
req: CreateOrganizationRequest,
) -> Result<Organization>
pub async fn create_organization( &self, req: CreateOrganizationRequest, ) -> Result<Organization>
Create an organization POST /organizations
Sourcepub async fn update_organization(
&self,
organization_id: &str,
req: UpdateOrganizationRequest,
) -> Result<Organization>
pub async fn update_organization( &self, organization_id: &str, req: UpdateOrganizationRequest, ) -> Result<Organization>
Update an organization PATCH /organizations/{organization_id}
Sourcepub async fn delete_organization(
&self,
organization_id: &str,
) -> Result<DeletedObject>
pub async fn delete_organization( &self, organization_id: &str, ) -> Result<DeletedObject>
Delete an organization DELETE /organizations/{organization_id}