Skip to content

sift_client.resources.users

CLASS DESCRIPTION
UsersAPIAsync

High-level API for users.

UsersAPIAsync

UsersAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for users.

A user's name is their login name, typically their email address.

Initialize the UsersAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
get

Get a user by ID.

list_

List users with optional filtering.

find

Find a single user matching the query. Raises if more than one matches.

resolve_ids

Resolve user login emails (their user names) to user IDs.

ATTRIBUTE DESCRIPTION
client

TYPE: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

get async

get(*, user_id: str) -> User

Get a user by ID.

PARAMETER DESCRIPTION
user_id

The ID of the user to retrieve.

TYPE: str

RETURNS DESCRIPTION
User

The User.

list_ async

list_(
    *,
    name: str | None = None,
    names: list[str] | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | None = None,
    include_inactive: bool = False,
    organization_id: str | None = None,
    filter_query: str | None = None,
    order_by: str | None = None,
    limit: int | None = None,
    page_size: int | None = None,
) -> list[User]

List users with optional filtering.

PARAMETER DESCRIPTION
name

Exact login name (typically the email address).

TYPE: str | None DEFAULT: None

names

Login names to filter by.

TYPE: list[str] | None DEFAULT: None

name_contains

Substring match on the login name.

TYPE: str | None DEFAULT: None

name_regex

Regex match on the login name.

TYPE: str | Pattern | None DEFAULT: None

include_inactive

If True, include inactive users.

TYPE: bool DEFAULT: False

organization_id

Scope the search to this organization. Only supported when listing active users.

TYPE: str | None DEFAULT: None

filter_query

Explicit CEL query.

TYPE: str | None DEFAULT: None

order_by

Field and direction to order by.

TYPE: str | None DEFAULT: None

limit

Maximum number of users to return.

TYPE: int | None DEFAULT: None

page_size

Results to fetch per request.

TYPE: int | None DEFAULT: None

RETURNS DESCRIPTION
list[User]

The matching users.

find async

find(**kwargs) -> User | None

Find a single user matching the query. Raises if more than one matches.

Takes the same arguments as list_.

resolve_ids async

resolve_ids(emails: list[str]) -> dict[str, str]

Resolve user login emails (their user names) to user IDs.

Returns a mapping of email to user ID for the emails that were found. Emails with no matching user are omitted.

PARAMETER DESCRIPTION
emails

The login emails to resolve.

TYPE: list[str]