sym.sdk.event.Event¶
- class sym.sdk.event.Event(srn: Union[sym.sdk.resource.SRN, str])¶
Bases:
sym.sdk.resource.SymResource
The
Event
class contains information on an event which has been received by Sym, routed to aRun
of aFlow
, and is triggering specific user-defined Handlers.Each Handler will be invoked with a single argument, which is an instance of this class. This
Event
instance will describe the current execution state, and can be used to dynamically alter the behavior and control flow of Templates.Read more about Handlers.
Methods
dict
()Represent this resource as a dictionary.
get_actor
(event_name)get_context
(event_name)Retrieve a dict containing the context values attached to a specific
Event
.Attributes
A
Channel
object indicating the channel the currentEvent
instance is coming from.A
Flow
object, indicating theFlow
that the currentRun
is an instance of.An
EventMeta
object, which contains metadata about theEvent
instance.The name of the
Event
.A
Payload
object, which contains the primary data of theEvent
.A
SRN
object that represents the unique identifier for this resource.A
Template
object, indicating whichTemplate
the currentFlow
inherits from.- property channel¶
A
Channel
object indicating the channel the currentEvent
instance is coming from.
- dict()¶
Represent this resource as a dictionary.
- get_actor(event_name: str) Optional[sym.sdk.user.User] ¶
Retrieve the
User
who triggered a specificEvent
.For example, for a
Run
using theApprovalTemplate
, to get the approver:approver = event.get_actor("approve")
For a list of event names, see the relevant template’s Enum (e.g.
ApprovalTemplateStep
).Note that, for the
ApprovalTemplate
, theescalate
anddeescalate
actors will be the same as theapprove
actor, because those events are automatically triggered by theapprove
event.
- get_context(event_name: str) Optional[Dict[str, Any]] ¶
Retrieve a dict containing the context values attached to a specific
Event
.For example, for a
Run
using theApprovalTemplate
, to get the context attached to the initial requestEvent
:context = event.get_context("request")
For a list of event names, see the relevant template’s Enum (e.g.
ApprovalTemplateStep
).