jetraw.users module

User management for Jetraw.

This module provides functionality to retrieve and manage user information. User objects are read-only as user settings are managed through Auth0.

class jetraw.users.User(user, client)

Bases: object

Represents a Jetraw user.

User objects are read-only as user settings and authentication are managed through Auth0. This class provides access to basic user information like ID, username, and name.

Example

>>> # Get a user by ID or username
>>> user = get_user("john.doe")
>>> print(f"User: {user.name} {user.surname}")
>>>
>>> # List all users
>>> users = list_users()
>>> for user in users:
...     print(f"{user.username}: {user.name}")
property id: str

Get the unique identifier of the user.

property name

Get the first name of the user.

property surname

Get the surname of the user.

property username: str

Get the username of the user.

jetraw.users.get_user(id_or_username, *, client=None)

Get a user by ID or username.

Parameters:
  • id_or_username (str) – User ID or username to retrieve

  • client (Client) – Jetraw client instance (uses default if None)

Returns:

The user object

Return type:

User

Raises:

KeyError – If the user is not found

Example

>>> # Get user by username
>>> user = get_user("john.doe")
>>> print(f"Found user: {user.name}")
>>>
>>> # Get user by ID
>>> user = get_user("user-id-123")
>>> print(f"Username: {user.username}")
jetraw.users.list_users(*, client=None)

List all users in the organization.

Parameters:

client (Client) – Jetraw client instance (uses default if None)

Returns:

List of all users in the organization

Return type:

list[User]

Example

>>> # List all users
>>> users = list_users()
>>> for user in users:
...     print(f"{user.username}: {user.name} {user.surname}")
>>>
>>> # Find users by name
>>> users = list_users()
>>> johns = [u for u in users if u.name == "John"]
>>> print(f"Found {len(johns)} users named John")