pub struct UsersApi { /* private fields */ }Expand description
User management, invites, roles
Implementations§
Source§impl UsersApi
impl UsersApi
Sourcepub async fn accept_invite(
&self,
invite_id: &str,
body: &AcceptInviteRequest,
) -> Result<AcceptInviteResponse>
pub async fn accept_invite( &self, invite_id: &str, body: &AcceptInviteRequest, ) -> Result<AcceptInviteResponse>
Accept an invite from its email link
The email-link flow. The invite is resolved against the CALLER’S ACTIVE TENANT, which is
what makes this route unusable from the tenant picker — a cross-tenant invitee is not a
member of the inviting tenant yet. POST /api/v1/me/invites/{tenantId}/{inviteId}/accept
exists for that case and takes the tenant in the path.
Same two gates as its sibling, in the same order: the presented token is compared
constant-time to the invite’s secret, and the caller’s email must match the invite’s,
compared case-insensitively. The email check is what stops a member who knows another
invitee’s id from burning that invite — which would create the user record with the
invitee’s email while the audit trail named the wrong actor, and leave the real invitee
facing an unexplained “already accepted”.
POST /api/v1/users/invites/{inviteId}/accept
Required scopes: users:write.
Sourcepub async fn delete(&self, user_id: &str) -> Result<DeleteUserResponse>
pub async fn delete(&self, user_id: &str) -> Result<DeleteUserResponse>
Delete user
DELETE /api/v1/users/{userId}
Required scopes: users:write.
Sourcepub async fn delete_invite(
&self,
invite_id: &str,
) -> Result<DeleteInviteResponse>
pub async fn delete_invite( &self, invite_id: &str, ) -> Result<DeleteInviteResponse>
Revoke a pending user invite
DELETE /api/v1/users/invites/{inviteId}
Required scopes: users:write.
Sourcepub async fn get(&self, user_id: &str) -> Result<Map<String, Value>>
pub async fn get(&self, user_id: &str) -> Result<Map<String, Value>>
Get user
GET /api/v1/users/{userId}
Required scopes: users:read.
Sourcepub async fn invite_user(
&self,
body: &InviteUserRequest,
) -> Result<InviteUserResponse>
pub async fn invite_user( &self, body: &InviteUserRequest, ) -> Result<InviteUserResponse>
Invite user
POST /api/v1/users/invites
Required scopes: users:write.
Sourcepub async fn list(&self) -> Result<ListUsersResponse>
pub async fn list(&self) -> Result<ListUsersResponse>
List users
GET /api/v1/users
Required scopes: users:read.
Sourcepub async fn list_invites(&self) -> Result<ListInvitesResponse>
pub async fn list_invites(&self) -> Result<ListInvitesResponse>
List invites
GET /api/v1/users/invites
Required scopes: users:read.
Sourcepub async fn resend_invite(
&self,
invite_id: &str,
) -> Result<ResendInviteResponse>
pub async fn resend_invite( &self, invite_id: &str, ) -> Result<ResendInviteResponse>
Resend the invite email
POST /api/v1/users/invites/{inviteId}/resend
Required scopes: users:write.
Sourcepub async fn set_user_role(
&self,
user_id: &str,
body: &SetUserRoleRequest,
) -> Result<SetUserRoleResponse>
pub async fn set_user_role( &self, user_id: &str, body: &SetUserRoleRequest, ) -> Result<SetUserRoleResponse>
Set user role
PUT /api/v1/users/{userId}/role
Required scopes: users:write.
Sourcepub async fn suspend_user(&self, user_id: &str) -> Result<SuspendUserResponse>
pub async fn suspend_user(&self, user_id: &str) -> Result<SuspendUserResponse>
Suspend user
PUT /api/v1/users/{userId}/suspend
Required scopes: users:write.
Sourcepub async fn transfer_tenant_ownership(
&self,
user_id: &str,
) -> Result<TransferTenantOwnershipResponse>
pub async fn transfer_tenant_ownership( &self, user_id: &str, ) -> Result<TransferTenantOwnershipResponse>
Transfer tenant ownership to this user
Demotes the calling owner to admin and promotes the target user to owner. Irreversible without a counter-transfer.
POST /api/v1/users/{userId}/transfer-ownership
Required scopes: users:write.
Sourcepub async fn unsuspend_user(
&self,
user_id: &str,
) -> Result<UnsuspendUserResponse>
pub async fn unsuspend_user( &self, user_id: &str, ) -> Result<UnsuspendUserResponse>
Reverse a suspension and restore the user
PUT /api/v1/users/{userId}/unsuspend
Required scopes: users:write.