"""Users (self-service) client for integration tests.""" import logging logger = logging.getLogger(__name__) class UsersClient: """Wraps user self-service API calls.""" def __init__(self, client): self._client = client def get_profile(self) -> dict: """Get the current user's profile.""" return self._client.get("/users/me") def update_profile(self, **fields) -> dict: """Update profile fields (full_name, avatar_url).""" return self._client.patch("/users/me", data=fields) def change_password(self, current_password: str, new_password: str, new_password_confirm: str) -> dict: """Change the current user's password.""" return self._client.post( "/users/me/password", data={ "current_password": current_password, "new_password": new_password, "new_password_confirm": new_password_confirm, }, ) def delete_account(self) -> dict: """Soft-delete the current user's account.""" return self._client.delete("/users/me") def get_my_organizations(self) -> dict: """List organizations the current user belongs to.""" return self._client.get("/users/me/organizations") def get_my_memberships(self) -> dict: """List detailed memberships across orgs.""" return self._client.get("/users/me/memberships") def get_my_principals(self) -> dict: """List principals the current user has access to.""" return self._client.get("/users/me/principals") def get_my_invites(self) -> dict: """List pending invites for the current user.""" return self._client.get("/users/me/invites")