Source code for sinch.domains.voice.models.v2.svaml.shared.message

from sinch.core.models.internal.unions import ResolveUnion
from typing import Annotated, Literal, Optional, Union

from pydantic import Field, StrictStr

from sinch.domains.voice.models.v2.internal.base.base_model_configuration import (
    BaseModelConfiguration,
)
from sinch.domains.voice.models.v2.types.voice_name import VoiceName


[docs] class Say(BaseModelConfiguration): text: StrictStr = Field( default=..., description="The text to be synthesized into speech.\n\nIf `format` is `TEXT` (default), provide plain text.\nIf `format` is `SSML`, provide a valid SSML document (for example, `<speak>...</speak>`).", ) format: Optional[Union[Literal["TEXT", "SSML"], StrictStr]] = Field( default=None, description="Format of the message" ) voice_name: VoiceName = Field( default=..., alias="voiceName", description="The name of the voice to use for text-to-speech synthesis.", )
[docs] class SayMessage(BaseModelConfiguration): type: Literal["SAY"] = Field( default="SAY", description="Text-to-speech message to be played during the call.", ) say: Say = Field(default=...)
[docs] class Play(BaseModelConfiguration): url: StrictStr = Field(default=..., description="URL of the media to send")
[docs] class PlayMessage(BaseModelConfiguration): type: Literal["PLAY"] = Field( default="PLAY", description="Audio file playback during the call." ) play: Play = Field(default=...)
Message = Annotated[ Union[ SayMessage, PlayMessage, ], ResolveUnion(discriminator="type"), ]