controller.http_data_formatter¶
This file contains methods to format data for HTTP requests.
Module Contents¶
Classes¶
Functions¶
|
Creates a list of buttons for each agent's option. |
|
Creates a message with a text response. |
|
Creates a message containing an attachment. |
|
Creates a message along with a list of buttons. |
|
Creates a message with movie information. |
Attributes¶
- controller.http_data_formatter.HTTP_OBJECT_MESSAGE¶
- controller.http_data_formatter.SHORT_ANSWER¶
- class controller.http_data_formatter.Message¶
- text: str¶
- intent: str¶
- attachments: List[Attachment]¶
- controller.http_data_formatter.create_buttons(user_options: moviebot.agent.agent.DialogueOptions) List[Dict[str, Any]]¶
Creates a list of buttons for each agent’s option.
- Parameters
user_options – Agent’s options
- Returns
List of buttons objects.
- controller.http_data_formatter.text_message(user_id: str, message: str, intent: str = 'UNK') HTTP_OBJECT_MESSAGE¶
Creates a message with a text response.
- Parameters
user_id – Id of the recipient.
message – Message to send.
intent – Intent of the message. Defaults to ‘UNK’.
- Returns
Object to send to Flask server.
- controller.http_data_formatter.attachment_message(user_id: str, message: str, attachments: List[Attachment], intent: str = 'UNK') HTTP_OBJECT_MESSAGE¶
Creates a message containing an attachment.
- Parameters
user_id – Id of the recipient.
message – Message to send.
attachments – Attachments to send.
intent – Intent of the message.
- Returns
Object with message containing an attachment to send to Flask server.
- controller.http_data_formatter.buttons_message(user_id: str, buttons: List[Dict[str, Any]], text: str, intent='UNK') HTTP_OBJECT_MESSAGE¶
Creates a message along with a list of buttons.
- Parameters
user_id – Id of the recipient.
buttons – List of buttons.
text – Message to send.
intent – Intent of the message.
- Returns
Object with message and buttons to send to Flask server.
- controller.http_data_formatter.movie_message(user_id: str, info: Dict[str, Any], intent: str) HTTP_OBJECT_MESSAGE¶
Creates a message with movie information.
- Parameters
user_id – Id of the recipient.
info – Movie information.
intent – Intent of the message.
- Returns
Object with movie message to send to the server.