Skip to content

User Operations (v2)

GraphQL operations for reading users. See the v2 guide for how client.v2 relates to client.v1/client.user.

API Reference

UserOperations

UserOperations(client: Any, graphql_url: str, user_id_cache: UserIdCache | None = None)

Bases: GraphQLOperations, UserOperationsMixin

Class to handle v2 (GraphQL) operations related to users.

Methods:

  • details –

    Get details for a user.

  • list –

    List every user in the organization.

Methods:

details
details(user_id: int | None = None) -> User

Get details for a user.

Parameters:

  • user_id (int | None, default: None ) –

    The ID of the user (defaults to the current user).

Returns:

  • User –

    A User model instance.

Example
client.v2.user.details()
# Returns: User(id=1, first_name='John', last_name='Doe', ...)
list
list() -> list[User]

List every user in the organization.

Returns:

  • list[User] –

    A list of User model instances, ordered by full name.

Example
client.v2.user.list()
# Returns: [User(id=1, full_name='John Doe', ...), ...]

Async Version

The async version AsyncUserOperations provides the same methods as above, but with async/await support:

AsyncUserOperations

AsyncUserOperations(client: Any, graphql_url: str, user_id_cache: UserIdCache | None = None)

Async class to handle v2 (GraphQL) operations related to users.

Async Usage

All methods have the same parameters and return types as their sync counterparts. Simply add await before each method call.

Usage Examples

from bloomy import Client

with Client(api_key="your-api-key") as client:
    # Get current user details
    me = client.v2.user.details()
    print(f"Name: {me.full_name}")

    # Get a specific user
    user = client.v2.user.details(user_id=456)

    # List every user in the organization
    all_users = client.v2.user.list()
import asyncio
from bloomy import AsyncClient

async def main():
    async with AsyncClient(api_key="your-api-key") as client:
        # Get current user details
        me = await client.v2.user.details()
        print(f"Name: {me.full_name}")

        # Get a specific user
        user = await client.v2.user.details(user_id=456)

        # List every user in the organization
        all_users = await client.v2.user.list()

asyncio.run(main())

Available Methods

Method Description Parameters Returns
details() Get a user user_id (optional, defaults to current user) User
list() List every user in the organization, ordered by full name None list[User]

Scope

client.v2.user is read-only. There is no client.v2 equivalent of client.v1.user.search(), direct_reports(), or positions() — use client.user (v1) for those.