citrine.resources.user module
Resources that represent both individual and collections of users.
- class citrine.resources.user.User(*, screen_name: str, email: str, position: str | None, is_admin: bool)
Bases:
Resource
[User
]A Citrine User.
- Parameters:
screen_name (str) – Screen name of the user.
email (str) – Email address of the user.
position (str) – Position of the user.
is_admin (bool) – Whether or not the user is an administrator.
session (Session, optional) – Citrine session used to connect to the database.
- access_control_dict() dict
Return an access control entity representation of this resource. Internal use only.
- classmethod build(data: dict) Self
Build an instance of this object from given data.
- dump() dict
Dump this instance.
- get()
Retrieve a specific user from the database.
- email: str = None
- is_admin: bool = None
- property is_internal: bool
Indicates if this user is a Citrine employee.
- position: str | None = None
- screen_name: str = None
- uid = None
- class citrine.resources.user.UserCollection(session: Session)
Bases:
AdminCollection
[User
]Represents the collection of all users.
- build(data)
Build an individual user from a dictionary.
- Parameters:
data (dict) – A dictionary representing the user.
- Returns:
The user created from data.
- Return type:
- get(uid: UUID | str) ResourceType
Get a particular element of the collection.
- list(*, per_page: int = 100, as_admin: bool = False) Iterator[ResourceType]
Paginate over the elements of the collection.
Leaving page and per_page as default values will yield all elements in the collection, paginating over all available pages.
- Parameters:
per_page (int, optional) – Max number of results to return per page. Default is 100. This parameter is used when making requests to the backend service. If the page parameter is specified it limits the maximum number of elements in the response.
as_admin (bool, optional) – Whether this request should be made as an admin (returning all teams, rather than only those to which the user belongs).
- Returns:
An iterator that can be used to loop over all the resources in this collection. Use list() to force evaluation of all results into an in-memory list.
- Return type:
Iterator[ResourceType]
- me()
Get information about the current user.
- update(model: CreationType) CreationType
Update a particular element of the collection.