shipany.bot.conversation.models
shipany.bot.conversation.models package
Subpackages
- shipany.bot.conversation.models.activations package
- Submodules
- shipany.bot.conversation.models.activations.base module
- shipany.bot.conversation.models.activations.command module
- shipany.bot.conversation.models.activations.event module
- shipany.bot.conversation.models.activations.timeout module
- shipany.bot.conversation.models.activations.webhook module
- Module contents
Submodules
shipany.bot.conversation.models.action module
pydantic model shipany.bot.conversation.models.action.BaseAction
Bases: BaseModel
Base action model.
Requires a name field to be present to identify the action class.
It is allowed to have any additional fields in the action configuration. The fields are validated against the action schema defined in the action registry.
- Config:
- extra: str = allow
- Fields:
field name : str [Required]
Action name in the format of name@version. Name must be alphanumeric. Version must be a number.
- Constraints:
- pattern = ([a-zA-Z]+)@(d+)
shipany.bot.conversation.models.conversation module
pydantic model shipany.bot.conversation.models.conversation.Conversation
Bases: BaseModel
Conversation model.
Describes a single conversation flow - a sequence of steps activated by some activity in the messenger.
- Fields:
activations (list[shipany.bot.conversation.models.activations.command.CommandActivation | shipany.bot.conversation.models.activations.event.EventActivation | shipany.bot.conversation.models.activations.webhook.WebhookActivation | shipany.bot.conversation.models.activations.timeout.TimeoutActivation])conversation_id (str)steps (list[shipany.bot.conversation.models.steps.Step])
field conversation_id : str [Required] (alias ‘$id’)
Unique conversation identifier.
field activations : Activations [Required]
List of activations that trigger the conversation steps.
field steps : Steps [Required]
List of steps in the conversation.
shipany.bot.conversation.models.flow module
pydantic model shipany.bot.conversation.models.flow.Flow
Bases: BaseModel
Flow model. The root of the conversation description.
Webhooks are optional and can be used as conversation triggers or as source of telegram updates.
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
field self_schema : HttpUrl [Required] (alias ‘$schema’)
Schema URL
- Constraints:
- max_length = 2083
- allowed_schemes = [‘http’, ‘https’]
field name : str [Required]
Bot name.
field description : str [Required]
Shortly describes the bot’s purpose.
field version : ManifestVersion = ‘1.0.0’
Version of the conversation description. Supports semantic versioning.
- Constraints:
-
__module__ = shipany.bot.contrib.semver.model
-
__doc__ = Pydantic annotation for the Version class.
.. meta::private
-
__get_pydantic_core_schema__ = <bound method _VersionPydanticAnnotation._get_pydantic_core_schema_ of <class ‘shipany.bot.contrib.semver.model._VersionPydanticAnnotation’>>
-
__get_pydantic_json_schema__ = <bound method _VersionPydanticAnnotation._get_pydantic_json_schema_ of <class ‘shipany.bot.contrib.semver.model._VersionPydanticAnnotation’>>
-
__dict__ = {‘_module_’: ‘shipany.bot.contrib.semver.model’, ‘_doc_’: ‘Pydantic annotation for the Version class.nn .. meta::privaten ‘, ‘_get_pydantic_core_schema_’: <classmethod(<function _VersionPydanticAnnotation._get_pydantic_core_schema_ at 0x10a4a8cc0>)>, ‘_get_pydantic_json_schema_’: <classmethod(<function _VersionPydanticAnnotation._get_pydantic_json_schema_ at 0x10a4a8d60>)>, ‘_dict_’: <attribute ‘_dict_’ of ‘VersionPydanticAnnotation’ objects>, ‘_weakref__’: <attribute ‘_weakref_’ of ‘_VersionPydanticAnnotation’ objects>}
-
__weakref__ = <attribute ‘_weakref_’ of ‘_VersionPydanticAnnotation’ objects>
-
field conversations : list[Conversation] [Required]
List of conversation flows supported by the bot.
field webhooks : list[WebhookParameters] [Optional]
List of webhooks supported by the bot.
shipany.bot.conversation.models.steps module
pydantic model shipany.bot.conversation.models.steps.Step
Bases: BaseModel
Represents a single step in the conversation flow. Contains a list of actions to perform.
Usually, a step is a single message sent by the bot or a user’s response. But it can also be a complex action like sending a file or making an API request. The actions have a specific order and are executed one by one unless transition to another step is triggered. The step can have a unique identifier to be referenced from other steps. Actions may refer to steps within the same conversation.
field step_id : str [Required] (alias ‘$id’)
field actions : list[BaseAction] = []
List of actions to perform in the step
shipany.bot.conversation.models.validators module
shipany.bot.conversation.models.validators.check_for_orphaned_conversations(flow)
Check for orphaned conversations in the flow.
- Parameters: flow (Flow)
- Return type: None
shipany.bot.conversation.models.validators.check_missed_start_state(flow)
Check for missed start state in the flow.
- Parameters: flow (Flow)
- Return type: None
shipany.bot.conversation.models.webhooks module
class shipany.bot.conversation.models.webhooks.WebhookMethod
Bases: StrEnum
Webhook HTTP methods.
POST = ‘POST’
__new__(value)
pydantic model shipany.bot.conversation.models.webhooks.Expectation
Bases: BaseModel
Expectation model.
Contains information about the expected HTTP attributes of the request. Helps to safeguard the webhook from malicious requests.
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
field headers : dict[str, str] [Required]
Expected headers.
field query_params : dict[str, str] [Required] (alias ‘query-parameters’)
Expected query parameters.
pydantic model shipany.bot.conversation.models.webhooks.WebhookParameters
Bases: BaseModel
Webhook parameters.
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
field webhook_id : str [Required] (alias ‘$id’)
Unique webhook identifier. Can be used to reference the webhook in activations.
field path : str [Required]
Webhook endpoint.
field status_code_ok : int [Required] (alias ‘status-code-ok’)
Expected status code for a successful response.
field status_code_error : int [Required] (alias ‘status-code-error’)
Expected status code for an error response.
field method : WebhookMethod [Required]
HTTP method to use for the webhook.
field expect : Expectation [Required]
Expected parameters of the incoming request. Use for bot-side validation.