sym.sdk.user.User¶
- class sym.sdk.user.User¶
Bases:
sym.sdk.resource.SymBaseResource
The atomic representation of a user in Sym.
UserIdentity
, which are used for referencing said user in external systems.Methods
dict
()Represent this resource as a dictionary.
get_event_count
(event_name[, since, until, ...])Retrieve a count of
Events
that have occurred onRuns
where thisUser
was the requester.identity
(service_type[, service_id])Retrieves this
User
'sUserIdentity
for a particular external system.Attributes
The
User
's email if the user is of type "normal", or None otherwise.The
User
's first name.The
User
's globally unique identifier.Retrieves the set of identities associated with this
User
, grouped by service type.The
User
's last name.The
User
's role (i.e., "admin", "member", or "guest").The
User
's type (i.e., "bot" or "normal").The
User
's username if the user is of type "bot", or the email if the user is of type "normal".- dict()¶
Represent this resource as a dictionary.
- get_event_count(event_name: ApprovalTemplateStep, since: Optional[datetime.datetime] = None, until: Optional[datetime.datetime] = None, filter_on: Literal['flow', 'target'] = 'flow', include_errored: bool = False) int ¶
Retrieve a count of
Events
that have occurred onRuns
where thisUser
was the requester.For example, to determine whether this
User
has ever been granted access to the currentFlow
via Sym, the following check could be used:if user.get_event_count( event_name=ApprovalTemplateStep.ESCALATE, filter_on="flow", ) > 0: ...
- Parameters
event_name – The name of the
Event
to count.since – Filter counted
Events
to those that were scheduled to be processed at or after this time.until – Filter counted
Events
to those that were scheduled to be processed at or before this time.filter_on – Filter counted
Events
to those that occurred onRuns
using the sameFlow
if “flow” is given, or where the sameAccessTarget
was requested if “target” is given.include_errored – Whether to count
Events
that were ignored or encountered errors while being processed.
- property identities¶
Retrieves the set of identities associated with this
User
, grouped by service type.A mapping of service types to lists of
UserIdentity
.
- identity(service_type: str, service_id: Optional[str] = None) Optional[sym.sdk.user.UserIdentity] ¶
Retrieves this
User
’sUserIdentity
for a particular external system.External systems specified by a service_type, and optionally a service_id.
- Parameters
service_type – The name of one of Sym’s
integrations
.service_id – An identifier for an instance of a service, such as a Slack Workspace ID.
- Returns
A
UserIdentity
, or None if no identity is found for the Integration.