Skip to content

Users

Sync and async user resources: list, get, create, update, and delete.

UsersResource

Bases: BaseResource

Synchronous access to the /users endpoints.

All methods raise subclasses of :class:~ineepy.exceptions.IneepyError; authentication/permission failures raise :class:~ineepy.exceptions.UnauthorizedError / :class:~ineepy.exceptions.ForbiddenError.

create(email, password, scopes, username, *, is_active=True)

Create a new user (admin only).

The server endpoint is bulk (it accepts an array of users); this method always sends a single-element array and unwraps the result. There is no bulk-create method yet.

Parameters:

Name Type Description Default
email str

User email address.

required
password str

User password.

required
scopes str | Iterable[str]

Scope name, or an iterable of scope names, to grant (e.g. editor, viewer).

required
username str

Username.

required
is_active bool

Whether the user is active. Defaults to True.

True

Returns:

Type Description
UserResponse

The created :class:~ineepy.UserResponse.

Raises:

Type Description
ConflictError

A user with the same email or username already exists.

delete(user_id)

Delete a user.

Parameters:

Name Type Description Default
user_id int | Literal['me']

User identifier (int for numeric ID, or 'me').

required

Raises:

Type Description
NotFoundError

No user with the given user_id.

get(user_id)

Get a user and its current ETag.

Parameters:

Name Type Description Default
user_id int | Literal['me']

User identifier (int for numeric ID, or 'me').

required

Returns:

Type Description
tuple[UserResponse, str]

Tuple of :class:~ineepy.UserResponse and ETag string.

Raises:

Type Description
NotFoundError

No user with the given user_id.

Example::

user, etag = client.users.get('me')

get_etag(user_id)

Return the current ETag for a user without fetching its body.

Parameters:

Name Type Description Default
user_id int | Literal['me']

User identifier (int or 'me').

required

Returns:

Type Description
str

ETag string for use in conditional requests.

Raises:

Type Description
NotFoundError

No user with the given user_id.

list(*, limit=None, offset=None, filters=None, order_by=None)

Return a paginated list of users (admin only).

Parameters:

Name Type Description Default
limit int | None

Maximum number of items to return.

None
offset int | None

Number of items to skip.

None
filters str | Iterable[str] | None

Filter expressions in field:operator:value format (a single string or an iterable of strings).

None
order_by str | Iterable[str] | None

Sort expressions in field:direction format (a single string or an iterable of strings).

None

Returns:

Type Description
UsersListResponse

class:~ineepy.UsersListResponse containing metadata and a list of :class:~ineepy.UserResponse items.

Example::

response = client.users.list(limit=10)

update(user_id, etag=None, *, password=None, username=None, scopes=None, is_active=None)

Update user's profile.

Only the fields you pass are modified; omitted fields keep their current values.

Parameters:

Name Type Description Default
user_id int | Literal['me']

User identifier (int for numeric ID, or 'me').

required
etag str | None

ETag for optimistic locking. When None, the current ETag is fetched automatically via :meth:get_etag.

None
password str | None

User password.

None
username str | None

Username.

None
scopes str | Iterable[str] | None

Scope name, or an iterable of scope names, to grant (e.g. editor, viewer).

None
is_active bool | None

Whether the user is active.

None

Returns:

Type Description
tuple[UserResponse, str]

Tuple of updated :class:~ineepy.UserResponse and new ETag.

Raises:

Type Description
NotFoundError

No user with the given user_id.

PreconditionFailedError

ETag mismatch (concurrent modification).

Example::

user, etag = client.users.update('me', username='new-name')

AsyncUsersResource

Bases: AsyncBaseResource

Async access to the /users endpoints.

All methods raise subclasses of :class:~ineepy.exceptions.IneepyError; authentication/permission failures raise :class:~ineepy.exceptions.UnauthorizedError / :class:~ineepy.exceptions.ForbiddenError.

create(email, password, scopes, username, *, is_active=True) async

Create a new user (admin only).

See :meth:UsersResource.create for full documentation.

delete(user_id) async

Delete a user.

See :meth:UsersResource.delete for full documentation.

get(user_id) async

Get a user and its current ETag.

See :meth:UsersResource.get for full documentation.

get_etag(user_id) async

Return the current ETag for a user without fetching its body.

See :meth:UsersResource.get_etag for full documentation.

list(*, limit=None, offset=None, filters=None, order_by=None) async

Return a paginated list of users (admin only).

See :meth:UsersResource.list for full documentation.

update(user_id, etag=None, *, password=None, username=None, scopes=None, is_active=None) async

Update user's profile.

See :meth:UsersResource.update for full documentation.