Skip to content

whatsapie/schema_generator/text_schema.py

generate_text_schema(body, message)

Generate schema for Text.

Parameters:

Name Type Description Default
body dict

Parent api schema object.

required
message Text

Text instance.

required

Returns:

Name Type Description
body

Schema body

Source code in whatsapie/schema_generator/text_schema.py
def generate_text_schema(body: dict, message: Text):
    """Generate schema for Text.

    Args:
        body: Parent api schema object.
        message: Text instance.

    Returns:
        body: Schema body
    """
    body["type"] = "text"
    body["text"] = {"preview_url": message.preview_url, "body": message.body}

    return body