sym.sdk.request_destination

Representation of different options for routing Sym Requests.

Classes

RequestDestination

A super-class for classes representing a Sym Request Destination.

RequestDestinationFallback

A list of RequestDestination to attempt to send requests to.

RequestForwardContext

An object containing additional context about the current and next destinations of the Sym Request.

SlackChannelID

A Request to be sent to a Slack Channel, identified by a Slack Channel ID, e.g.

SlackChannelName

A Request to be sent to a Slack Channel, identified by a Slack Channel name.

SlackRequestDestination

A super-class for classes representing a destination in Slack.

SlackUser

A Request to be sent to a Slack User, identified by a Slack User ID.

SlackUserGroup

A Request to be sent in a Slack Group DM including the given Slack Users, with a maximum of 7 Users.

pydantic model sym.sdk.request_destination.RequestDestination

Bases: pydantic.main.BaseModel

A super-class for classes representing a Sym Request Destination.

Fields
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).

pydantic model sym.sdk.request_destination.RequestDestinationFallback

Bases: pydantic.main.BaseModel

A list of RequestDestination to attempt to send requests to. The next RequestDestination will be attempted based on the failure mode configuration.

Fields
field continue_on_delivery_failure: bool = True

If set to True, if Sym fails to deliver a Request to a RequestDestination (such as when the Slack Channel does not exist), then the next RequestDestination in the destinations list will be attempted.

field continue_on_timeout: bool = False

If set to True, if the current Request times out, then a new Request will be sent to the next RequestDestination in the destinations list.

field destinations: List[sym.sdk.request_destination.RequestDestination] [Required]

The list of RequestDestination objects to attempt to send requests to.

pydantic model sym.sdk.request_destination.RequestForwardContext

Bases: pydantic.main.BaseModel

An object containing additional context about the current and next destinations of the Sym Request. An instance of this class is included as an argument when on_request_forward and after_request_forward hooks are invoked by the Sym Runtime.

Fields
field all_request_destinations: List[sym.sdk.request_destination.RequestDestination] [Required]

A list of all RequestDestination instances that this Sym Request may be sent to

field current_destination_index: int [Required]

An integer representing the index of the current destination in all_request_destinations

field next_destination_index: Optional[int] = None

An integer representing the index of the next destination in all_request_destinations. When set to None, this means that the current_destination_index is at the last element of all_request_destinations, i.e there are no more destinations to try next.

pydantic model sym.sdk.request_destination.SlackChannelID

Bases: sym.sdk.request_destination.SlackRequestDestination

A Request to be sent to a Slack Channel, identified by a Slack Channel ID, e.g. ‘C12345’.

Fields
Validators
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field channel_id: str [Required]

A string that identifies a Slack Channel by its unique ID. e.g. ‘C12345’.

Validated by
field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).

validator validate_channel_id_format  »  channel_id

Validates that the given channel_id follows Slack’s convention of starting with a C, D or G. (e.g. ‘D12345’).

pydantic model sym.sdk.request_destination.SlackChannelName

Bases: sym.sdk.request_destination.SlackRequestDestination

A Request to be sent to a Slack Channel, identified by a Slack Channel name.

Fields
Validators
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field channel_name: str [Required]

A string that identifies a Slack Channel by its unique name. (e.g. ‘#sym-errors’).

Validated by
field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).

validator validate_channel_name_format  »  channel_name
pydantic model sym.sdk.request_destination.SlackRequestDestination

Bases: sym.sdk.request_destination.RequestDestination

A super-class for classes representing a destination in Slack.

Fields
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).

pydantic model sym.sdk.request_destination.SlackUser

Bases: sym.sdk.request_destination.SlackRequestDestination

A Request to be sent to a Slack User, identified by a Slack User ID.

Fields
Validators
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

field user_id: str [Required]

A string that identifies a Slack User by their unique ID (also called Member ID). (e.g. ‘U12345’).

Validated by
mention() str

Returns a string that can be used to @mention this User in a Slack message.

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).

validator validate_user_id_format  »  user_id

Validates that the given user_id follows Slack’s convention of starting with a U or W. (e.g. ‘U12345’).

pydantic model sym.sdk.request_destination.SlackUserGroup

Bases: sym.sdk.request_destination.SlackRequestDestination

A Request to be sent in a Slack Group DM including the given Slack Users, with a maximum of 7 Users.

Fields
field allow_self: bool = False

A boolean indicating whether the requester may approve this Request.

field timeout: Optional[int] = None

An optional integer representing the duration until this destination will time out, in seconds. If not specified, then the destination will never time out, i.e the Request will hang indefinitely until responded to.

field users: List[sym.sdk.request_destination.SlackUser] [Required]

A list of SlackUser objects to include in the group DM. Note: While each SlackUser object supports an allow_self attribute, this attribute will ignored in favor of the allow_self attribute set on the SlackUserGroup object.

Constraints
  • minItems = 1

  • maxItems = 7

classmethod parse_obj(obj)

Without this method override, Pydantic will not call our custom validator when parsing a RequestDestination directly (e.g. RequestDestination.parse_obj(…)). It will only be called when parsing fields that contain a RequestDestination object (e.g. SlackUserGroup.parse_obj(…), where the users field contains SlackUsers which are subclasses of RequestDestination).