1from pathlib import Path 2 3from fishjam._composition_openapi_client.models import ( 4 AudioChannels, 5 AudioMixingStrategy, 6 AudioScene, 7 AudioSceneInput, 8 AverageAndMaxBitrate, 9 BoxShadow, 10 CompositionCreatedResponse, 11 CreateCompositionRequest, 12 EasingFunctionBounce, 13 EasingFunctionBounceFunctionName, 14 EasingFunctionCubicBezier, 15 EasingFunctionCubicBezierFunctionName, 16 EasingFunctionLinear, 17 EasingFunctionLinearFunctionName, 18 FontUpload, 19 H264EncoderPreset, 20 HorizontalAlign, 21 Image, 22 ImageSpecAuto, 23 ImageSpecAutoAssetType, 24 ImageSpecGif, 25 ImageSpecGifAssetType, 26 ImageSpecJpeg, 27 ImageSpecJpegAssetType, 28 ImageSpecPng, 29 ImageSpecPngAssetType, 30 ImageSpecSvg, 31 ImageSpecSvgAssetType, 32 ImageType, 33 InputStream, 34 InputStreamType, 35 Interpolation, 36 Mp4Input, 37 Mp4InputType, 38 OpusEncoderPreset, 39 OutputEndCondition, 40 OutputRtmpClientAudioOptions, 41 OutputRtmpClientVideoOptions, 42 OutputWhipAudioOptions, 43 OutputWhipVideoOptions, 44 Overflow, 45 PixelFormat, 46 RegisterInputResponse, 47 RegisterTemplateOutput, 48 RescaleMode, 49 Rescaler, 50 RescalerType, 51 Resolution, 52 RtmpInput, 53 RtmpInputType, 54 RtmpOutput, 55 RtmpOutputType, 56 Text, 57 TextStyle, 58 TextType, 59 TextWeight, 60 TextWrapMode, 61 Tiles, 62 TilesType, 63 Transition, 64 TransportProtocol, 65 UnregisterInput, 66 UnregisterOutput, 67 UnregisterRenderer, 68 UpdateOutputRequest, 69 VerticalAlign, 70 VideoScene, 71 View, 72 ViewDirection, 73 ViewType, 74 WhepInput, 75 WhepInputType, 76 WhipAudioEncoderOptionsAny, 77 WhipAudioEncoderOptionsAnyType, 78 WhipAudioEncoderOptionsOpus, 79 WhipAudioEncoderOptionsOpusType, 80 WhipInput, 81 WhipInputType, 82 WhipOutput, 83 WhipOutputType, 84) 85 86FileSource = bytes | str | Path 87"""Where an upload comes from: the bytes themselves, or a path to read them from.""" 88 89ImageSpec = ImageSpecAuto | ImageSpecGif | ImageSpecJpeg | ImageSpecPng | ImageSpecSvg 90"""How an image is fetched and decoded, one member per asset type.""" 91 92RegisterInput = Mp4Input | RtmpInput | WhepInput | WhipInput 93"""Configuration of a media source, one member per input type.""" 94 95RegisterOutput = RtmpOutput | WhipOutput 96"""Configuration of a destination, one member per output type.""" 97 98__all__ = [ 99 "FileSource", 100 "ImageSpec", 101 "RegisterInput", 102 "RegisterOutput", 103 "AudioChannels", 104 "AudioMixingStrategy", 105 "AudioScene", 106 "AudioSceneInput", 107 "AverageAndMaxBitrate", 108 "BoxShadow", 109 "CompositionCreatedResponse", 110 "CreateCompositionRequest", 111 "EasingFunctionBounce", 112 "EasingFunctionBounceFunctionName", 113 "EasingFunctionCubicBezier", 114 "EasingFunctionCubicBezierFunctionName", 115 "EasingFunctionLinear", 116 "EasingFunctionLinearFunctionName", 117 "FontUpload", 118 "H264EncoderPreset", 119 "HorizontalAlign", 120 "Image", 121 "ImageSpecAuto", 122 "ImageSpecAutoAssetType", 123 "ImageSpecGif", 124 "ImageSpecGifAssetType", 125 "ImageSpecJpeg", 126 "ImageSpecJpegAssetType", 127 "ImageSpecPng", 128 "ImageSpecPngAssetType", 129 "ImageSpecSvg", 130 "ImageSpecSvgAssetType", 131 "ImageType", 132 "InputStream", 133 "InputStreamType", 134 "Interpolation", 135 "Mp4Input", 136 "Mp4InputType", 137 "OpusEncoderPreset", 138 "OutputEndCondition", 139 "OutputRtmpClientAudioOptions", 140 "OutputRtmpClientVideoOptions", 141 "OutputWhipAudioOptions", 142 "OutputWhipVideoOptions", 143 "Overflow", 144 "PixelFormat", 145 "RegisterInputResponse", 146 "RegisterTemplateOutput", 147 "RescaleMode", 148 "Rescaler", 149 "RescalerType", 150 "Resolution", 151 "RtmpInput", 152 "RtmpInputType", 153 "RtmpOutput", 154 "RtmpOutputType", 155 "Text", 156 "TextStyle", 157 "TextType", 158 "TextWeight", 159 "TextWrapMode", 160 "Tiles", 161 "TilesType", 162 "Transition", 163 "TransportProtocol", 164 "UnregisterInput", 165 "UnregisterOutput", 166 "UnregisterRenderer", 167 "UpdateOutputRequest", 168 "VerticalAlign", 169 "VideoScene", 170 "View", 171 "ViewDirection", 172 "ViewType", 173 "WhepInput", 174 "WhepInputType", 175 "WhipAudioEncoderOptionsAny", 176 "WhipAudioEncoderOptionsAnyType", 177 "WhipAudioEncoderOptionsOpus", 178 "WhipAudioEncoderOptionsOpusType", 179 "WhipInput", 180 "WhipInputType", 181 "WhipOutput", 182 "WhipOutputType", 183]
Where an upload comes from: the bytes themselves, or a path to read them from.
How an image is fetched and decoded, one member per asset type.
Configuration of a media source, one member per input type.
Configuration of a destination, one member per output type.
5class AudioChannels(str, Enum): 6 """None""" 7 8 MONO = "mono" 9 STEREO = "stereo" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class AudioMixingStrategy(str, Enum): 6 """None""" 7 8 SUM_CLIP = "sum_clip" 9 SUM_SCALE = "sum_scale" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
16@_attrs_define 17class AudioScene: 18 """ 19 Attributes: 20 inputs (list[AudioSceneInput]): 21 """ 22 23 inputs: list[AudioSceneInput] 24 25 def to_dict(self) -> dict[str, Any]: 26 inputs = [] 27 for inputs_item_data in self.inputs: 28 inputs_item = inputs_item_data.to_dict() 29 inputs.append(inputs_item) 30 31 field_dict: dict[str, Any] = {} 32 33 field_dict.update({ 34 "inputs": inputs, 35 }) 36 37 return field_dict 38 39 @classmethod 40 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 41 from ..models.audio_scene_input import AudioSceneInput 42 43 d = dict(src_dict) 44 inputs = [] 45 _inputs = d.pop("inputs") 46 for inputs_item_data in _inputs: 47 inputs_item = AudioSceneInput.from_dict(inputs_item_data) 48 49 inputs.append(inputs_item) 50 51 audio_scene = cls( 52 inputs=inputs, 53 ) 54 55 return audio_scene
Attributes:
- inputs (list[AudioSceneInput]):
39 @classmethod 40 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 41 from ..models.audio_scene_input import AudioSceneInput 42 43 d = dict(src_dict) 44 inputs = [] 45 _inputs = d.pop("inputs") 46 for inputs_item_data in _inputs: 47 inputs_item = AudioSceneInput.from_dict(inputs_item_data) 48 49 inputs.append(inputs_item) 50 51 audio_scene = cls( 52 inputs=inputs, 53 ) 54 55 return audio_scene
14@_attrs_define 15class AudioSceneInput: 16 """ 17 Attributes: 18 input_id (str): 19 volume (float | None | Unset): (**default=`1.0`**) float in `[0, 2]` range representing input volume 20 """ 21 22 input_id: str 23 volume: float | None | Unset = UNSET 24 25 def to_dict(self) -> dict[str, Any]: 26 input_id = self.input_id 27 28 volume: float | None | Unset 29 if isinstance(self.volume, Unset): 30 volume = UNSET 31 else: 32 volume = self.volume 33 34 field_dict: dict[str, Any] = {} 35 36 field_dict.update({ 37 "input_id": input_id, 38 }) 39 if volume is not UNSET: 40 field_dict["volume"] = volume 41 42 return field_dict 43 44 @classmethod 45 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 46 d = dict(src_dict) 47 input_id = d.pop("input_id") 48 49 def _parse_volume(data: object) -> float | None | Unset: 50 if data is None: 51 return data 52 if isinstance(data, Unset): 53 return data 54 return cast(float | None | Unset, data) 55 56 volume = _parse_volume(d.pop("volume", UNSET)) 57 58 audio_scene_input = cls( 59 input_id=input_id, 60 volume=volume, 61 ) 62 63 return audio_scene_input
Attributes:
- input_id (str):
- volume (float | None | Unset): (default=
1.0) float in[0, 2]range representing input volume
24def __init__(self, input_id, volume=attr_dict['volume'].default): 25 self.input_id = input_id 26 self.volume = volume
Method generated by attrs for class AudioSceneInput.
25 def to_dict(self) -> dict[str, Any]: 26 input_id = self.input_id 27 28 volume: float | None | Unset 29 if isinstance(self.volume, Unset): 30 volume = UNSET 31 else: 32 volume = self.volume 33 34 field_dict: dict[str, Any] = {} 35 36 field_dict.update({ 37 "input_id": input_id, 38 }) 39 if volume is not UNSET: 40 field_dict["volume"] = volume 41 42 return field_dict
44 @classmethod 45 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 46 d = dict(src_dict) 47 input_id = d.pop("input_id") 48 49 def _parse_volume(data: object) -> float | None | Unset: 50 if data is None: 51 return data 52 if isinstance(data, Unset): 53 return data 54 return cast(float | None | Unset, data) 55 56 volume = _parse_volume(d.pop("volume", UNSET)) 57 58 audio_scene_input = cls( 59 input_id=input_id, 60 volume=volume, 61 ) 62 63 return audio_scene_input
13@_attrs_define 14class AverageAndMaxBitrate: 15 """ 16 Attributes: 17 average_bitrate (int): Average bitrate measured in bits/second. Encoder will try to keep the bitrate around the 18 provided average, 19 but may temporarily increase it to the provided max bitrate. 20 max_bitrate (int): Max bitrate measured in bits/second. 21 """ 22 23 average_bitrate: int 24 max_bitrate: int 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 average_bitrate = self.average_bitrate 29 30 max_bitrate = self.max_bitrate 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "average_bitrate": average_bitrate, 36 "max_bitrate": max_bitrate, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 average_bitrate = d.pop("average_bitrate") 45 46 max_bitrate = d.pop("max_bitrate") 47 48 average_and_max_bitrate = cls( 49 average_bitrate=average_bitrate, 50 max_bitrate=max_bitrate, 51 ) 52 53 average_and_max_bitrate.additional_properties = d 54 return average_and_max_bitrate 55 56 @property 57 def additional_keys(self) -> list[str]: 58 return list(self.additional_properties.keys()) 59 60 def __getitem__(self, key: str) -> Any: 61 return self.additional_properties[key] 62 63 def __setitem__(self, key: str, value: Any) -> None: 64 self.additional_properties[key] = value 65 66 def __delitem__(self, key: str) -> None: 67 del self.additional_properties[key] 68 69 def __contains__(self, key: str) -> bool: 70 return key in self.additional_properties
Attributes:
- average_bitrate (int): Average bitrate measured in bits/second. Encoder will try to keep the bitrate around the provided average, but may temporarily increase it to the provided max bitrate.
- max_bitrate (int): Max bitrate measured in bits/second.
25def __init__(self, average_bitrate, max_bitrate): 26 self.average_bitrate = average_bitrate 27 self.max_bitrate = max_bitrate 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class AverageAndMaxBitrate.
27 def to_dict(self) -> dict[str, Any]: 28 average_bitrate = self.average_bitrate 29 30 max_bitrate = self.max_bitrate 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "average_bitrate": average_bitrate, 36 "max_bitrate": max_bitrate, 37 }) 38 39 return field_dict
41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 average_bitrate = d.pop("average_bitrate") 45 46 max_bitrate = d.pop("max_bitrate") 47 48 average_and_max_bitrate = cls( 49 average_bitrate=average_bitrate, 50 max_bitrate=max_bitrate, 51 ) 52 53 average_and_max_bitrate.additional_properties = d 54 return average_and_max_bitrate
14@_attrs_define 15class BoxShadow: 16 """ 17 Attributes: 18 offset_x (float | None | Unset): 19 offset_y (float | None | Unset): 20 color (None | str | Unset): 21 blur_radius (float | None | Unset): 22 """ 23 24 offset_x: float | None | Unset = UNSET 25 offset_y: float | None | Unset = UNSET 26 color: None | str | Unset = UNSET 27 blur_radius: float | None | Unset = UNSET 28 29 def to_dict(self) -> dict[str, Any]: 30 offset_x: float | None | Unset 31 if isinstance(self.offset_x, Unset): 32 offset_x = UNSET 33 else: 34 offset_x = self.offset_x 35 36 offset_y: float | None | Unset 37 if isinstance(self.offset_y, Unset): 38 offset_y = UNSET 39 else: 40 offset_y = self.offset_y 41 42 color: None | str | Unset 43 if isinstance(self.color, Unset): 44 color = UNSET 45 else: 46 color = self.color 47 48 blur_radius: float | None | Unset 49 if isinstance(self.blur_radius, Unset): 50 blur_radius = UNSET 51 else: 52 blur_radius = self.blur_radius 53 54 field_dict: dict[str, Any] = {} 55 56 field_dict.update({}) 57 if offset_x is not UNSET: 58 field_dict["offset_x"] = offset_x 59 if offset_y is not UNSET: 60 field_dict["offset_y"] = offset_y 61 if color is not UNSET: 62 field_dict["color"] = color 63 if blur_radius is not UNSET: 64 field_dict["blur_radius"] = blur_radius 65 66 return field_dict 67 68 @classmethod 69 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 70 d = dict(src_dict) 71 72 def _parse_offset_x(data: object) -> float | None | Unset: 73 if data is None: 74 return data 75 if isinstance(data, Unset): 76 return data 77 return cast(float | None | Unset, data) 78 79 offset_x = _parse_offset_x(d.pop("offset_x", UNSET)) 80 81 def _parse_offset_y(data: object) -> float | None | Unset: 82 if data is None: 83 return data 84 if isinstance(data, Unset): 85 return data 86 return cast(float | None | Unset, data) 87 88 offset_y = _parse_offset_y(d.pop("offset_y", UNSET)) 89 90 def _parse_color(data: object) -> None | str | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 return cast(None | str | Unset, data) 96 97 color = _parse_color(d.pop("color", UNSET)) 98 99 def _parse_blur_radius(data: object) -> float | None | Unset: 100 if data is None: 101 return data 102 if isinstance(data, Unset): 103 return data 104 return cast(float | None | Unset, data) 105 106 blur_radius = _parse_blur_radius(d.pop("blur_radius", UNSET)) 107 108 box_shadow = cls( 109 offset_x=offset_x, 110 offset_y=offset_y, 111 color=color, 112 blur_radius=blur_radius, 113 ) 114 115 return box_shadow
Attributes:
- offset_x (float | None | Unset):
- offset_y (float | None | Unset):
- color (None | str | Unset):
- blur_radius (float | None | Unset):
26def __init__(self, offset_x=attr_dict['offset_x'].default, offset_y=attr_dict['offset_y'].default, color=attr_dict['color'].default, blur_radius=attr_dict['blur_radius'].default): 27 self.offset_x = offset_x 28 self.offset_y = offset_y 29 self.color = color 30 self.blur_radius = blur_radius
Method generated by attrs for class BoxShadow.
29 def to_dict(self) -> dict[str, Any]: 30 offset_x: float | None | Unset 31 if isinstance(self.offset_x, Unset): 32 offset_x = UNSET 33 else: 34 offset_x = self.offset_x 35 36 offset_y: float | None | Unset 37 if isinstance(self.offset_y, Unset): 38 offset_y = UNSET 39 else: 40 offset_y = self.offset_y 41 42 color: None | str | Unset 43 if isinstance(self.color, Unset): 44 color = UNSET 45 else: 46 color = self.color 47 48 blur_radius: float | None | Unset 49 if isinstance(self.blur_radius, Unset): 50 blur_radius = UNSET 51 else: 52 blur_radius = self.blur_radius 53 54 field_dict: dict[str, Any] = {} 55 56 field_dict.update({}) 57 if offset_x is not UNSET: 58 field_dict["offset_x"] = offset_x 59 if offset_y is not UNSET: 60 field_dict["offset_y"] = offset_y 61 if color is not UNSET: 62 field_dict["color"] = color 63 if blur_radius is not UNSET: 64 field_dict["blur_radius"] = blur_radius 65 66 return field_dict
68 @classmethod 69 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 70 d = dict(src_dict) 71 72 def _parse_offset_x(data: object) -> float | None | Unset: 73 if data is None: 74 return data 75 if isinstance(data, Unset): 76 return data 77 return cast(float | None | Unset, data) 78 79 offset_x = _parse_offset_x(d.pop("offset_x", UNSET)) 80 81 def _parse_offset_y(data: object) -> float | None | Unset: 82 if data is None: 83 return data 84 if isinstance(data, Unset): 85 return data 86 return cast(float | None | Unset, data) 87 88 offset_y = _parse_offset_y(d.pop("offset_y", UNSET)) 89 90 def _parse_color(data: object) -> None | str | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 return cast(None | str | Unset, data) 96 97 color = _parse_color(d.pop("color", UNSET)) 98 99 def _parse_blur_radius(data: object) -> float | None | Unset: 100 if data is None: 101 return data 102 if isinstance(data, Unset): 103 return data 104 return cast(float | None | Unset, data) 105 106 blur_radius = _parse_blur_radius(d.pop("blur_radius", UNSET)) 107 108 box_shadow = cls( 109 offset_x=offset_x, 110 offset_y=offset_y, 111 color=color, 112 blur_radius=blur_radius, 113 ) 114 115 return box_shadow
13@_attrs_define 14class CompositionCreatedResponse: 15 """ 16 Attributes: 17 composition_id (str): 18 api_url (str): 19 """ 20 21 composition_id: str 22 api_url: str 23 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 24 25 def to_dict(self) -> dict[str, Any]: 26 composition_id = self.composition_id 27 28 api_url = self.api_url 29 30 field_dict: dict[str, Any] = {} 31 field_dict.update(self.additional_properties) 32 field_dict.update({ 33 "composition_id": composition_id, 34 "api_url": api_url, 35 }) 36 37 return field_dict 38 39 @classmethod 40 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 41 d = dict(src_dict) 42 composition_id = d.pop("composition_id") 43 44 api_url = d.pop("api_url") 45 46 composition_created_response = cls( 47 composition_id=composition_id, 48 api_url=api_url, 49 ) 50 51 composition_created_response.additional_properties = d 52 return composition_created_response 53 54 @property 55 def additional_keys(self) -> list[str]: 56 return list(self.additional_properties.keys()) 57 58 def __getitem__(self, key: str) -> Any: 59 return self.additional_properties[key] 60 61 def __setitem__(self, key: str, value: Any) -> None: 62 self.additional_properties[key] = value 63 64 def __delitem__(self, key: str) -> None: 65 del self.additional_properties[key] 66 67 def __contains__(self, key: str) -> bool: 68 return key in self.additional_properties
Attributes:
- composition_id (str):
- api_url (str):
25def __init__(self, composition_id, api_url): 26 self.composition_id = composition_id 27 self.api_url = api_url 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class CompositionCreatedResponse.
25 def to_dict(self) -> dict[str, Any]: 26 composition_id = self.composition_id 27 28 api_url = self.api_url 29 30 field_dict: dict[str, Any] = {} 31 field_dict.update(self.additional_properties) 32 field_dict.update({ 33 "composition_id": composition_id, 34 "api_url": api_url, 35 }) 36 37 return field_dict
39 @classmethod 40 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 41 d = dict(src_dict) 42 composition_id = d.pop("composition_id") 43 44 api_url = d.pop("api_url") 45 46 composition_created_response = cls( 47 composition_id=composition_id, 48 api_url=api_url, 49 ) 50 51 composition_created_response.additional_properties = d 52 return composition_created_response
14@_attrs_define 15class CreateCompositionRequest: 16 """ 17 Attributes: 18 autostart (bool | Unset): If true, outputs will immediately start producing audio and video. 19 If false, call `POST /api/composition/{composition_id}/start` to start the composition. Default: True. 20 cleanup_without_inputs (bool | Unset): If true (default), the composition will be cleaned up after 5 minutes 21 when all **inputs** 22 have zero bitrate, regardless of output bitrate. This prevents circular liveness when 23 composition output is sent to a stream. 24 If false, cleanup only triggers when both inputs and outputs have zero bitrate. Default: True. 25 """ 26 27 autostart: bool | Unset = True 28 cleanup_without_inputs: bool | Unset = True 29 30 def to_dict(self) -> dict[str, Any]: 31 autostart = self.autostart 32 33 cleanup_without_inputs = self.cleanup_without_inputs 34 35 field_dict: dict[str, Any] = {} 36 37 field_dict.update({}) 38 if autostart is not UNSET: 39 field_dict["autostart"] = autostart 40 if cleanup_without_inputs is not UNSET: 41 field_dict["cleanup_without_inputs"] = cleanup_without_inputs 42 43 return field_dict 44 45 @classmethod 46 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 47 d = dict(src_dict) 48 autostart = d.pop("autostart", UNSET) 49 50 cleanup_without_inputs = d.pop("cleanup_without_inputs", UNSET) 51 52 create_composition_request = cls( 53 autostart=autostart, 54 cleanup_without_inputs=cleanup_without_inputs, 55 ) 56 57 return create_composition_request
Attributes:
- autostart (bool | Unset): If true, outputs will immediately start producing audio and video.
If false, call
POST /api/composition/{composition_id}/startto start the composition. Default: True. - cleanup_without_inputs (bool | Unset): If true (default), the composition will be cleaned up after 5 minutes when all inputs have zero bitrate, regardless of output bitrate. This prevents circular liveness when composition output is sent to a stream. If false, cleanup only triggers when both inputs and outputs have zero bitrate. Default: True.
24def __init__(self, autostart=attr_dict['autostart'].default, cleanup_without_inputs=attr_dict['cleanup_without_inputs'].default): 25 self.autostart = autostart 26 self.cleanup_without_inputs = cleanup_without_inputs
Method generated by attrs for class CreateCompositionRequest.
30 def to_dict(self) -> dict[str, Any]: 31 autostart = self.autostart 32 33 cleanup_without_inputs = self.cleanup_without_inputs 34 35 field_dict: dict[str, Any] = {} 36 37 field_dict.update({}) 38 if autostart is not UNSET: 39 field_dict["autostart"] = autostart 40 if cleanup_without_inputs is not UNSET: 41 field_dict["cleanup_without_inputs"] = cleanup_without_inputs 42 43 return field_dict
45 @classmethod 46 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 47 d = dict(src_dict) 48 autostart = d.pop("autostart", UNSET) 49 50 cleanup_without_inputs = d.pop("cleanup_without_inputs", UNSET) 51 52 create_composition_request = cls( 53 autostart=autostart, 54 cleanup_without_inputs=cleanup_without_inputs, 55 ) 56 57 return create_composition_request
17@_attrs_define 18class EasingFunctionBounce: 19 """ 20 Attributes: 21 function_name (EasingFunctionBounceFunctionName): 22 """ 23 24 function_name: EasingFunctionBounceFunctionName 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 function_name = self.function_name.value 29 30 field_dict: dict[str, Any] = {} 31 field_dict.update(self.additional_properties) 32 field_dict.update({ 33 "function_name": function_name, 34 }) 35 36 return field_dict 37 38 @classmethod 39 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 40 d = dict(src_dict) 41 function_name = EasingFunctionBounceFunctionName(d.pop("function_name")) 42 43 easing_function_bounce = cls( 44 function_name=function_name, 45 ) 46 47 easing_function_bounce.additional_properties = d 48 return easing_function_bounce 49 50 @property 51 def additional_keys(self) -> list[str]: 52 return list(self.additional_properties.keys()) 53 54 def __getitem__(self, key: str) -> Any: 55 return self.additional_properties[key] 56 57 def __setitem__(self, key: str, value: Any) -> None: 58 self.additional_properties[key] = value 59 60 def __delitem__(self, key: str) -> None: 61 del self.additional_properties[key] 62 63 def __contains__(self, key: str) -> bool: 64 return key in self.additional_properties
Attributes:
- function_name (EasingFunctionBounceFunctionName):
24def __init__(self, function_name): 25 self.function_name = function_name 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class EasingFunctionBounce.
38 @classmethod 39 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 40 d = dict(src_dict) 41 function_name = EasingFunctionBounceFunctionName(d.pop("function_name")) 42 43 easing_function_bounce = cls( 44 function_name=function_name, 45 ) 46 47 easing_function_bounce.additional_properties = d 48 return easing_function_bounce
5class EasingFunctionBounceFunctionName(str, Enum): 6 """None""" 7 8 BOUNCE = "bounce" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
17@_attrs_define 18class EasingFunctionCubicBezier: 19 """ 20 Attributes: 21 points (list[float]): 22 function_name (EasingFunctionCubicBezierFunctionName): 23 """ 24 25 points: list[float] 26 function_name: EasingFunctionCubicBezierFunctionName 27 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 28 29 def to_dict(self) -> dict[str, Any]: 30 points = self.points 31 32 function_name = self.function_name.value 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({ 37 "points": points, 38 "function_name": function_name, 39 }) 40 41 return field_dict 42 43 @classmethod 44 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 45 d = dict(src_dict) 46 points = cast(list[float], d.pop("points")) 47 48 function_name = EasingFunctionCubicBezierFunctionName(d.pop("function_name")) 49 50 easing_function_cubic_bezier = cls( 51 points=points, 52 function_name=function_name, 53 ) 54 55 easing_function_cubic_bezier.additional_properties = d 56 return easing_function_cubic_bezier 57 58 @property 59 def additional_keys(self) -> list[str]: 60 return list(self.additional_properties.keys()) 61 62 def __getitem__(self, key: str) -> Any: 63 return self.additional_properties[key] 64 65 def __setitem__(self, key: str, value: Any) -> None: 66 self.additional_properties[key] = value 67 68 def __delitem__(self, key: str) -> None: 69 del self.additional_properties[key] 70 71 def __contains__(self, key: str) -> bool: 72 return key in self.additional_properties
Attributes:
- points (list[float]):
- function_name (EasingFunctionCubicBezierFunctionName):
25def __init__(self, points, function_name): 26 self.points = points 27 self.function_name = function_name 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class EasingFunctionCubicBezier.
29 def to_dict(self) -> dict[str, Any]: 30 points = self.points 31 32 function_name = self.function_name.value 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({ 37 "points": points, 38 "function_name": function_name, 39 }) 40 41 return field_dict
43 @classmethod 44 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 45 d = dict(src_dict) 46 points = cast(list[float], d.pop("points")) 47 48 function_name = EasingFunctionCubicBezierFunctionName(d.pop("function_name")) 49 50 easing_function_cubic_bezier = cls( 51 points=points, 52 function_name=function_name, 53 ) 54 55 easing_function_cubic_bezier.additional_properties = d 56 return easing_function_cubic_bezier
5class EasingFunctionCubicBezierFunctionName(str, Enum): 6 """None""" 7 8 CUBIC_BEZIER = "cubic_bezier" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
17@_attrs_define 18class EasingFunctionLinear: 19 """ 20 Attributes: 21 function_name (EasingFunctionLinearFunctionName): 22 """ 23 24 function_name: EasingFunctionLinearFunctionName 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 function_name = self.function_name.value 29 30 field_dict: dict[str, Any] = {} 31 field_dict.update(self.additional_properties) 32 field_dict.update({ 33 "function_name": function_name, 34 }) 35 36 return field_dict 37 38 @classmethod 39 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 40 d = dict(src_dict) 41 function_name = EasingFunctionLinearFunctionName(d.pop("function_name")) 42 43 easing_function_linear = cls( 44 function_name=function_name, 45 ) 46 47 easing_function_linear.additional_properties = d 48 return easing_function_linear 49 50 @property 51 def additional_keys(self) -> list[str]: 52 return list(self.additional_properties.keys()) 53 54 def __getitem__(self, key: str) -> Any: 55 return self.additional_properties[key] 56 57 def __setitem__(self, key: str, value: Any) -> None: 58 self.additional_properties[key] = value 59 60 def __delitem__(self, key: str) -> None: 61 del self.additional_properties[key] 62 63 def __contains__(self, key: str) -> bool: 64 return key in self.additional_properties
Attributes:
- function_name (EasingFunctionLinearFunctionName):
24def __init__(self, function_name): 25 self.function_name = function_name 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class EasingFunctionLinear.
38 @classmethod 39 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 40 d = dict(src_dict) 41 function_name = EasingFunctionLinearFunctionName(d.pop("function_name")) 42 43 easing_function_linear = cls( 44 function_name=function_name, 45 ) 46 47 easing_function_linear.additional_properties = d 48 return easing_function_linear
5class EasingFunctionLinearFunctionName(str, Enum): 6 """None""" 7 8 LINEAR = "linear" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
16@_attrs_define 17class FontUpload: 18 """ 19 Attributes: 20 font (File): 21 """ 22 23 font: File 24 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 25 26 def to_dict(self) -> dict[str, Any]: 27 font = self.font.to_tuple() 28 29 field_dict: dict[str, Any] = {} 30 field_dict.update(self.additional_properties) 31 field_dict.update({ 32 "font": font, 33 }) 34 35 return field_dict 36 37 @classmethod 38 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 39 d = dict(src_dict) 40 font = File(payload=BytesIO(d.pop("font"))) 41 42 font_upload = cls( 43 font=font, 44 ) 45 46 font_upload.additional_properties = d 47 return font_upload 48 49 @property 50 def additional_keys(self) -> list[str]: 51 return list(self.additional_properties.keys()) 52 53 def __getitem__(self, key: str) -> Any: 54 return self.additional_properties[key] 55 56 def __setitem__(self, key: str, value: Any) -> None: 57 self.additional_properties[key] = value 58 59 def __delitem__(self, key: str) -> None: 60 del self.additional_properties[key] 61 62 def __contains__(self, key: str) -> bool: 63 return key in self.additional_properties
Attributes:
- font (File):
24def __init__(self, font): 25 self.font = font 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class FontUpload.
5class H264EncoderPreset(str, Enum): 6 """None""" 7 8 FAST = "fast" 9 FASTER = "faster" 10 MEDIUM = "medium" 11 PLACEBO = "placebo" 12 SLOW = "slow" 13 SLOWER = "slower" 14 SUPERFAST = "superfast" 15 ULTRAFAST = "ultrafast" 16 VERYFAST = "veryfast" 17 VERYSLOW = "veryslow" 18 19 def __str__(self) -> str: 20 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class HorizontalAlign(str, Enum): 6 """None""" 7 8 CENTER = "center" 9 JUSTIFIED = "justified" 10 LEFT = "left" 11 RIGHT = "right" 12 13 def __str__(self) -> str: 14 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class Image: 17 """ 18 Attributes: 19 image_id (str): 20 type_ (ImageType): 21 id (None | str | Unset): 22 width (float | None | Unset): Width of the image in pixels. 23 If `height` is not explicitly provided, the image will automatically adjust its height to maintain its original 24 aspect ratio relative to the width. 25 height (float | None | Unset): Height of the image in pixels. 26 If `width` is not explicitly provided, the image will automatically adjust its width to maintain its original 27 aspect ratio relative to the height. 28 """ 29 30 image_id: str 31 type_: ImageType 32 id: None | str | Unset = UNSET 33 width: float | None | Unset = UNSET 34 height: float | None | Unset = UNSET 35 36 def to_dict(self) -> dict[str, Any]: 37 image_id = self.image_id 38 39 type_ = self.type_.value 40 41 id: None | str | Unset 42 if isinstance(self.id, Unset): 43 id = UNSET 44 else: 45 id = self.id 46 47 width: float | None | Unset 48 if isinstance(self.width, Unset): 49 width = UNSET 50 else: 51 width = self.width 52 53 height: float | None | Unset 54 if isinstance(self.height, Unset): 55 height = UNSET 56 else: 57 height = self.height 58 59 field_dict: dict[str, Any] = {} 60 61 field_dict.update({ 62 "image_id": image_id, 63 "type": type_, 64 }) 65 if id is not UNSET: 66 field_dict["id"] = id 67 if width is not UNSET: 68 field_dict["width"] = width 69 if height is not UNSET: 70 field_dict["height"] = height 71 72 return field_dict 73 74 @classmethod 75 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 76 d = dict(src_dict) 77 image_id = d.pop("image_id") 78 79 type_ = ImageType(d.pop("type")) 80 81 def _parse_id(data: object) -> None | str | Unset: 82 if data is None: 83 return data 84 if isinstance(data, Unset): 85 return data 86 return cast(None | str | Unset, data) 87 88 id = _parse_id(d.pop("id", UNSET)) 89 90 def _parse_width(data: object) -> float | None | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 return cast(float | None | Unset, data) 96 97 width = _parse_width(d.pop("width", UNSET)) 98 99 def _parse_height(data: object) -> float | None | Unset: 100 if data is None: 101 return data 102 if isinstance(data, Unset): 103 return data 104 return cast(float | None | Unset, data) 105 106 height = _parse_height(d.pop("height", UNSET)) 107 108 image = cls( 109 image_id=image_id, 110 type_=type_, 111 id=id, 112 width=width, 113 height=height, 114 ) 115 116 return image
Attributes:
- image_id (str):
- type_ (ImageType):
- id (None | str | Unset):
- width (float | None | Unset): Width of the image in pixels.
If
heightis not explicitly provided, the image will automatically adjust its height to maintain its original aspect ratio relative to the width. - height (float | None | Unset): Height of the image in pixels.
If
widthis not explicitly provided, the image will automatically adjust its width to maintain its original aspect ratio relative to the height.
27def __init__(self, image_id, type_, id=attr_dict['id'].default, width=attr_dict['width'].default, height=attr_dict['height'].default): 28 self.image_id = image_id 29 self.type_ = type_ 30 self.id = id 31 self.width = width 32 self.height = height
Method generated by attrs for class Image.
36 def to_dict(self) -> dict[str, Any]: 37 image_id = self.image_id 38 39 type_ = self.type_.value 40 41 id: None | str | Unset 42 if isinstance(self.id, Unset): 43 id = UNSET 44 else: 45 id = self.id 46 47 width: float | None | Unset 48 if isinstance(self.width, Unset): 49 width = UNSET 50 else: 51 width = self.width 52 53 height: float | None | Unset 54 if isinstance(self.height, Unset): 55 height = UNSET 56 else: 57 height = self.height 58 59 field_dict: dict[str, Any] = {} 60 61 field_dict.update({ 62 "image_id": image_id, 63 "type": type_, 64 }) 65 if id is not UNSET: 66 field_dict["id"] = id 67 if width is not UNSET: 68 field_dict["width"] = width 69 if height is not UNSET: 70 field_dict["height"] = height 71 72 return field_dict
74 @classmethod 75 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 76 d = dict(src_dict) 77 image_id = d.pop("image_id") 78 79 type_ = ImageType(d.pop("type")) 80 81 def _parse_id(data: object) -> None | str | Unset: 82 if data is None: 83 return data 84 if isinstance(data, Unset): 85 return data 86 return cast(None | str | Unset, data) 87 88 id = _parse_id(d.pop("id", UNSET)) 89 90 def _parse_width(data: object) -> float | None | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 return cast(float | None | Unset, data) 96 97 width = _parse_width(d.pop("width", UNSET)) 98 99 def _parse_height(data: object) -> float | None | Unset: 100 if data is None: 101 return data 102 if isinstance(data, Unset): 103 return data 104 return cast(float | None | Unset, data) 105 106 height = _parse_height(d.pop("height", UNSET)) 107 108 image = cls( 109 image_id=image_id, 110 type_=type_, 111 id=id, 112 width=width, 113 height=height, 114 ) 115 116 return image
15@_attrs_define 16class ImageSpecAuto: 17 """ 18 Attributes: 19 url (str): 20 asset_type (ImageSpecAutoAssetType): 21 """ 22 23 url: str 24 asset_type: ImageSpecAutoAssetType 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 url = self.url 29 30 asset_type = self.asset_type.value 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "url": url, 36 "asset_type": asset_type, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecAutoAssetType(d.pop("asset_type")) 47 48 image_spec_auto = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_auto.additional_properties = d 54 return image_spec_auto 55 56 @property 57 def additional_keys(self) -> list[str]: 58 return list(self.additional_properties.keys()) 59 60 def __getitem__(self, key: str) -> Any: 61 return self.additional_properties[key] 62 63 def __setitem__(self, key: str, value: Any) -> None: 64 self.additional_properties[key] = value 65 66 def __delitem__(self, key: str) -> None: 67 del self.additional_properties[key] 68 69 def __contains__(self, key: str) -> bool: 70 return key in self.additional_properties
Attributes:
- url (str):
- asset_type (ImageSpecAutoAssetType):
25def __init__(self, url, asset_type): 26 self.url = url 27 self.asset_type = asset_type 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class ImageSpecAuto.
41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecAutoAssetType(d.pop("asset_type")) 47 48 image_spec_auto = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_auto.additional_properties = d 54 return image_spec_auto
5class ImageSpecAutoAssetType(str, Enum): 6 """None""" 7 8 AUTO = "auto" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class ImageSpecGif: 17 """ 18 Attributes: 19 url (str): 20 asset_type (ImageSpecGifAssetType): 21 """ 22 23 url: str 24 asset_type: ImageSpecGifAssetType 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 url = self.url 29 30 asset_type = self.asset_type.value 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "url": url, 36 "asset_type": asset_type, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecGifAssetType(d.pop("asset_type")) 47 48 image_spec_gif = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_gif.additional_properties = d 54 return image_spec_gif 55 56 @property 57 def additional_keys(self) -> list[str]: 58 return list(self.additional_properties.keys()) 59 60 def __getitem__(self, key: str) -> Any: 61 return self.additional_properties[key] 62 63 def __setitem__(self, key: str, value: Any) -> None: 64 self.additional_properties[key] = value 65 66 def __delitem__(self, key: str) -> None: 67 del self.additional_properties[key] 68 69 def __contains__(self, key: str) -> bool: 70 return key in self.additional_properties
Attributes:
- url (str):
- asset_type (ImageSpecGifAssetType):
25def __init__(self, url, asset_type): 26 self.url = url 27 self.asset_type = asset_type 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class ImageSpecGif.
41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecGifAssetType(d.pop("asset_type")) 47 48 image_spec_gif = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_gif.additional_properties = d 54 return image_spec_gif
5class ImageSpecGifAssetType(str, Enum): 6 """None""" 7 8 GIF = "gif" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class ImageSpecJpeg: 17 """ 18 Attributes: 19 url (str): 20 asset_type (ImageSpecJpegAssetType): 21 """ 22 23 url: str 24 asset_type: ImageSpecJpegAssetType 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 url = self.url 29 30 asset_type = self.asset_type.value 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "url": url, 36 "asset_type": asset_type, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecJpegAssetType(d.pop("asset_type")) 47 48 image_spec_jpeg = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_jpeg.additional_properties = d 54 return image_spec_jpeg 55 56 @property 57 def additional_keys(self) -> list[str]: 58 return list(self.additional_properties.keys()) 59 60 def __getitem__(self, key: str) -> Any: 61 return self.additional_properties[key] 62 63 def __setitem__(self, key: str, value: Any) -> None: 64 self.additional_properties[key] = value 65 66 def __delitem__(self, key: str) -> None: 67 del self.additional_properties[key] 68 69 def __contains__(self, key: str) -> bool: 70 return key in self.additional_properties
Attributes:
- url (str):
- asset_type (ImageSpecJpegAssetType):
25def __init__(self, url, asset_type): 26 self.url = url 27 self.asset_type = asset_type 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class ImageSpecJpeg.
41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecJpegAssetType(d.pop("asset_type")) 47 48 image_spec_jpeg = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_jpeg.additional_properties = d 54 return image_spec_jpeg
5class ImageSpecJpegAssetType(str, Enum): 6 """None""" 7 8 JPEG = "jpeg" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class ImageSpecPng: 17 """ 18 Attributes: 19 url (str): 20 asset_type (ImageSpecPngAssetType): 21 """ 22 23 url: str 24 asset_type: ImageSpecPngAssetType 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 url = self.url 29 30 asset_type = self.asset_type.value 31 32 field_dict: dict[str, Any] = {} 33 field_dict.update(self.additional_properties) 34 field_dict.update({ 35 "url": url, 36 "asset_type": asset_type, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecPngAssetType(d.pop("asset_type")) 47 48 image_spec_png = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_png.additional_properties = d 54 return image_spec_png 55 56 @property 57 def additional_keys(self) -> list[str]: 58 return list(self.additional_properties.keys()) 59 60 def __getitem__(self, key: str) -> Any: 61 return self.additional_properties[key] 62 63 def __setitem__(self, key: str, value: Any) -> None: 64 self.additional_properties[key] = value 65 66 def __delitem__(self, key: str) -> None: 67 del self.additional_properties[key] 68 69 def __contains__(self, key: str) -> bool: 70 return key in self.additional_properties
Attributes:
- url (str):
- asset_type (ImageSpecPngAssetType):
25def __init__(self, url, asset_type): 26 self.url = url 27 self.asset_type = asset_type 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class ImageSpecPng.
41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 url = d.pop("url") 45 46 asset_type = ImageSpecPngAssetType(d.pop("asset_type")) 47 48 image_spec_png = cls( 49 url=url, 50 asset_type=asset_type, 51 ) 52 53 image_spec_png.additional_properties = d 54 return image_spec_png
5class ImageSpecPngAssetType(str, Enum): 6 """None""" 7 8 PNG = "png" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
20@_attrs_define 21class ImageSpecSvg: 22 """ 23 Attributes: 24 url (str): 25 asset_type (ImageSpecSvgAssetType): 26 resolution (None | Resolution | Unset): 27 """ 28 29 url: str 30 asset_type: ImageSpecSvgAssetType 31 resolution: None | Resolution | Unset = UNSET 32 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 33 34 def to_dict(self) -> dict[str, Any]: 35 from ..models.resolution import Resolution 36 37 url = self.url 38 39 asset_type = self.asset_type.value 40 41 resolution: dict[str, Any] | None | Unset 42 if isinstance(self.resolution, Unset): 43 resolution = UNSET 44 elif isinstance(self.resolution, Resolution): 45 resolution = self.resolution.to_dict() 46 else: 47 resolution = self.resolution 48 49 field_dict: dict[str, Any] = {} 50 field_dict.update(self.additional_properties) 51 field_dict.update({ 52 "url": url, 53 "asset_type": asset_type, 54 }) 55 if resolution is not UNSET: 56 field_dict["resolution"] = resolution 57 58 return field_dict 59 60 @classmethod 61 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 62 from ..models.resolution import Resolution 63 64 d = dict(src_dict) 65 url = d.pop("url") 66 67 asset_type = ImageSpecSvgAssetType(d.pop("asset_type")) 68 69 def _parse_resolution(data: object) -> None | Resolution | Unset: 70 if data is None: 71 return data 72 if isinstance(data, Unset): 73 return data 74 try: 75 if not isinstance(data, dict): 76 raise TypeError() 77 resolution_type_1 = Resolution.from_dict(data) 78 79 return resolution_type_1 80 except (TypeError, ValueError, AttributeError, KeyError): 81 pass 82 return cast(None | Resolution | Unset, data) 83 84 resolution = _parse_resolution(d.pop("resolution", UNSET)) 85 86 image_spec_svg = cls( 87 url=url, 88 asset_type=asset_type, 89 resolution=resolution, 90 ) 91 92 image_spec_svg.additional_properties = d 93 return image_spec_svg 94 95 @property 96 def additional_keys(self) -> list[str]: 97 return list(self.additional_properties.keys()) 98 99 def __getitem__(self, key: str) -> Any: 100 return self.additional_properties[key] 101 102 def __setitem__(self, key: str, value: Any) -> None: 103 self.additional_properties[key] = value 104 105 def __delitem__(self, key: str) -> None: 106 del self.additional_properties[key] 107 108 def __contains__(self, key: str) -> bool: 109 return key in self.additional_properties
Attributes:
- url (str):
- asset_type (ImageSpecSvgAssetType):
- resolution (None | Resolution | Unset):
26def __init__(self, url, asset_type, resolution=attr_dict['resolution'].default): 27 self.url = url 28 self.asset_type = asset_type 29 self.resolution = resolution 30 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class ImageSpecSvg.
34 def to_dict(self) -> dict[str, Any]: 35 from ..models.resolution import Resolution 36 37 url = self.url 38 39 asset_type = self.asset_type.value 40 41 resolution: dict[str, Any] | None | Unset 42 if isinstance(self.resolution, Unset): 43 resolution = UNSET 44 elif isinstance(self.resolution, Resolution): 45 resolution = self.resolution.to_dict() 46 else: 47 resolution = self.resolution 48 49 field_dict: dict[str, Any] = {} 50 field_dict.update(self.additional_properties) 51 field_dict.update({ 52 "url": url, 53 "asset_type": asset_type, 54 }) 55 if resolution is not UNSET: 56 field_dict["resolution"] = resolution 57 58 return field_dict
60 @classmethod 61 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 62 from ..models.resolution import Resolution 63 64 d = dict(src_dict) 65 url = d.pop("url") 66 67 asset_type = ImageSpecSvgAssetType(d.pop("asset_type")) 68 69 def _parse_resolution(data: object) -> None | Resolution | Unset: 70 if data is None: 71 return data 72 if isinstance(data, Unset): 73 return data 74 try: 75 if not isinstance(data, dict): 76 raise TypeError() 77 resolution_type_1 = Resolution.from_dict(data) 78 79 return resolution_type_1 80 except (TypeError, ValueError, AttributeError, KeyError): 81 pass 82 return cast(None | Resolution | Unset, data) 83 84 resolution = _parse_resolution(d.pop("resolution", UNSET)) 85 86 image_spec_svg = cls( 87 url=url, 88 asset_type=asset_type, 89 resolution=resolution, 90 ) 91 92 image_spec_svg.additional_properties = d 93 return image_spec_svg
5class ImageSpecSvgAssetType(str, Enum): 6 """None""" 7 8 SVG = "svg" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class ImageType(str, Enum): 6 """None""" 7 8 IMAGE = "image" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class InputStream: 17 """ 18 Attributes: 19 input_id (str): 20 type_ (InputStreamType): 21 id (None | str | Unset): 22 """ 23 24 input_id: str 25 type_: InputStreamType 26 id: None | str | Unset = UNSET 27 28 def to_dict(self) -> dict[str, Any]: 29 input_id = self.input_id 30 31 type_ = self.type_.value 32 33 id: None | str | Unset 34 if isinstance(self.id, Unset): 35 id = UNSET 36 else: 37 id = self.id 38 39 field_dict: dict[str, Any] = {} 40 41 field_dict.update({ 42 "input_id": input_id, 43 "type": type_, 44 }) 45 if id is not UNSET: 46 field_dict["id"] = id 47 48 return field_dict 49 50 @classmethod 51 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 52 d = dict(src_dict) 53 input_id = d.pop("input_id") 54 55 type_ = InputStreamType(d.pop("type")) 56 57 def _parse_id(data: object) -> None | str | Unset: 58 if data is None: 59 return data 60 if isinstance(data, Unset): 61 return data 62 return cast(None | str | Unset, data) 63 64 id = _parse_id(d.pop("id", UNSET)) 65 66 input_stream = cls( 67 input_id=input_id, 68 type_=type_, 69 id=id, 70 ) 71 72 return input_stream
Attributes:
- input_id (str):
- type_ (InputStreamType):
- id (None | str | Unset):
25def __init__(self, input_id, type_, id=attr_dict['id'].default): 26 self.input_id = input_id 27 self.type_ = type_ 28 self.id = id
Method generated by attrs for class InputStream.
28 def to_dict(self) -> dict[str, Any]: 29 input_id = self.input_id 30 31 type_ = self.type_.value 32 33 id: None | str | Unset 34 if isinstance(self.id, Unset): 35 id = UNSET 36 else: 37 id = self.id 38 39 field_dict: dict[str, Any] = {} 40 41 field_dict.update({ 42 "input_id": input_id, 43 "type": type_, 44 }) 45 if id is not UNSET: 46 field_dict["id"] = id 47 48 return field_dict
50 @classmethod 51 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 52 d = dict(src_dict) 53 input_id = d.pop("input_id") 54 55 type_ = InputStreamType(d.pop("type")) 56 57 def _parse_id(data: object) -> None | str | Unset: 58 if data is None: 59 return data 60 if isinstance(data, Unset): 61 return data 62 return cast(None | str | Unset, data) 63 64 id = _parse_id(d.pop("id", UNSET)) 65 66 input_stream = cls( 67 input_id=input_id, 68 type_=type_, 69 id=id, 70 ) 71 72 return input_stream
5class InputStreamType(str, Enum): 6 """None""" 7 8 INPUT_STREAM = "input_stream" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class Interpolation(str, Enum): 6 """None""" 7 8 LINEAR = "linear" 9 SPRING = "spring" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class Mp4Input: 17 """Input stream from an MP4 file. 18 19 Attributes: 20 url (str): URL of the MP4 file. 21 type_ (Mp4InputType): 22 loop (bool | None | Unset): (**default=`false`**) If input should be played in the loop. <span class="badge 23 badge--primary">Added in v0.4.0</span> 24 """ 25 26 url: str 27 type_: Mp4InputType 28 loop: bool | None | Unset = UNSET 29 30 def to_dict(self) -> dict[str, Any]: 31 url = self.url 32 33 type_ = self.type_.value 34 35 loop: bool | None | Unset 36 if isinstance(self.loop, Unset): 37 loop = UNSET 38 else: 39 loop = self.loop 40 41 field_dict: dict[str, Any] = {} 42 43 field_dict.update({ 44 "url": url, 45 "type": type_, 46 }) 47 if loop is not UNSET: 48 field_dict["loop"] = loop 49 50 return field_dict 51 52 @classmethod 53 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 54 d = dict(src_dict) 55 url = d.pop("url") 56 57 type_ = Mp4InputType(d.pop("type")) 58 59 def _parse_loop(data: object) -> bool | None | Unset: 60 if data is None: 61 return data 62 if isinstance(data, Unset): 63 return data 64 return cast(bool | None | Unset, data) 65 66 loop = _parse_loop(d.pop("loop", UNSET)) 67 68 mp_4_input = cls( 69 url=url, 70 type_=type_, 71 loop=loop, 72 ) 73 74 return mp_4_input
Input stream from an MP4 file.
Attributes:
- url (str): URL of the MP4 file.
- type_ (Mp4InputType):
- loop (bool | None | Unset): (default=
false) If input should be played in the loop. Added in v0.4.0
25def __init__(self, url, type_, loop=attr_dict['loop'].default): 26 self.url = url 27 self.type_ = type_ 28 self.loop = loop
Method generated by attrs for class Mp4Input.
30 def to_dict(self) -> dict[str, Any]: 31 url = self.url 32 33 type_ = self.type_.value 34 35 loop: bool | None | Unset 36 if isinstance(self.loop, Unset): 37 loop = UNSET 38 else: 39 loop = self.loop 40 41 field_dict: dict[str, Any] = {} 42 43 field_dict.update({ 44 "url": url, 45 "type": type_, 46 }) 47 if loop is not UNSET: 48 field_dict["loop"] = loop 49 50 return field_dict
52 @classmethod 53 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 54 d = dict(src_dict) 55 url = d.pop("url") 56 57 type_ = Mp4InputType(d.pop("type")) 58 59 def _parse_loop(data: object) -> bool | None | Unset: 60 if data is None: 61 return data 62 if isinstance(data, Unset): 63 return data 64 return cast(bool | None | Unset, data) 65 66 loop = _parse_loop(d.pop("loop", UNSET)) 67 68 mp_4_input = cls( 69 url=url, 70 type_=type_, 71 loop=loop, 72 ) 73 74 return mp_4_input
5class Mp4InputType(str, Enum): 6 """None""" 7 8 MP4 = "mp4" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class OpusEncoderPreset(str, Enum): 6 """None""" 7 8 LOWEST_LATENCY = "lowest_latency" 9 QUALITY = "quality" 10 VOIP = "voip" 11 12 def __str__(self) -> str: 13 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
14@_attrs_define 15class OutputEndCondition: 16 """This type defines when end of an input stream should trigger end of the output stream. Only one of those fields can 17 be set at the time. 18 Unless specified otherwise the input stream is considered finished/ended when: 19 - TCP connection was dropped/closed. 20 - RTCP Goodbye packet (`BYE`) was received. 21 - Mp4 track has ended. 22 - Input was unregistered already (or never registered). 23 24 Attributes: 25 any_of (list[str] | None | Unset): Terminate output stream if any of the input streams from the list are 26 finished. 27 all_of (list[str] | None | Unset): Terminate output stream if all the input streams from the list are finished. 28 any_input (bool | None | Unset): Terminate output stream if any of the input streams ends. This includes streams 29 added after the output was registered. In particular, output stream will **not be** terminated if no inputs were 30 ever connected. 31 all_inputs (bool | None | Unset): Terminate output stream if all the input streams finish. In particular, output 32 stream will **be** terminated if no inputs were ever connected. 33 """ 34 35 any_of: list[str] | None | Unset = UNSET 36 all_of: list[str] | None | Unset = UNSET 37 any_input: bool | None | Unset = UNSET 38 all_inputs: bool | None | Unset = UNSET 39 40 def to_dict(self) -> dict[str, Any]: 41 any_of: list[str] | None | Unset 42 if isinstance(self.any_of, Unset): 43 any_of = UNSET 44 elif isinstance(self.any_of, list): 45 any_of = self.any_of 46 47 else: 48 any_of = self.any_of 49 50 all_of: list[str] | None | Unset 51 if isinstance(self.all_of, Unset): 52 all_of = UNSET 53 elif isinstance(self.all_of, list): 54 all_of = self.all_of 55 56 else: 57 all_of = self.all_of 58 59 any_input: bool | None | Unset 60 if isinstance(self.any_input, Unset): 61 any_input = UNSET 62 else: 63 any_input = self.any_input 64 65 all_inputs: bool | None | Unset 66 if isinstance(self.all_inputs, Unset): 67 all_inputs = UNSET 68 else: 69 all_inputs = self.all_inputs 70 71 field_dict: dict[str, Any] = {} 72 73 field_dict.update({}) 74 if any_of is not UNSET: 75 field_dict["any_of"] = any_of 76 if all_of is not UNSET: 77 field_dict["all_of"] = all_of 78 if any_input is not UNSET: 79 field_dict["any_input"] = any_input 80 if all_inputs is not UNSET: 81 field_dict["all_inputs"] = all_inputs 82 83 return field_dict 84 85 @classmethod 86 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 87 d = dict(src_dict) 88 89 def _parse_any_of(data: object) -> list[str] | None | Unset: 90 if data is None: 91 return data 92 if isinstance(data, Unset): 93 return data 94 try: 95 if not isinstance(data, list): 96 raise TypeError() 97 any_of_type_0 = cast(list[str], data) 98 99 return any_of_type_0 100 except (TypeError, ValueError, AttributeError, KeyError): 101 pass 102 return cast(list[str] | None | Unset, data) 103 104 any_of = _parse_any_of(d.pop("any_of", UNSET)) 105 106 def _parse_all_of(data: object) -> list[str] | None | Unset: 107 if data is None: 108 return data 109 if isinstance(data, Unset): 110 return data 111 try: 112 if not isinstance(data, list): 113 raise TypeError() 114 all_of_type_0 = cast(list[str], data) 115 116 return all_of_type_0 117 except (TypeError, ValueError, AttributeError, KeyError): 118 pass 119 return cast(list[str] | None | Unset, data) 120 121 all_of = _parse_all_of(d.pop("all_of", UNSET)) 122 123 def _parse_any_input(data: object) -> bool | None | Unset: 124 if data is None: 125 return data 126 if isinstance(data, Unset): 127 return data 128 return cast(bool | None | Unset, data) 129 130 any_input = _parse_any_input(d.pop("any_input", UNSET)) 131 132 def _parse_all_inputs(data: object) -> bool | None | Unset: 133 if data is None: 134 return data 135 if isinstance(data, Unset): 136 return data 137 return cast(bool | None | Unset, data) 138 139 all_inputs = _parse_all_inputs(d.pop("all_inputs", UNSET)) 140 141 output_end_condition = cls( 142 any_of=any_of, 143 all_of=all_of, 144 any_input=any_input, 145 all_inputs=all_inputs, 146 ) 147 148 return output_end_condition
This type defines when end of an input stream should trigger end of the output stream. Only one of those fields can be set at the time. Unless specified otherwise the input stream is considered finished/ended when:
- TCP connection was dropped/closed.
- RTCP Goodbye packet (
BYE) was received. - Mp4 track has ended.
- Input was unregistered already (or never registered).
- Attributes: any_of (list[str] | None | Unset): Terminate output stream if any of the input streams from the list are
- finished. all_of (list[str] | None | Unset): Terminate output stream if all the input streams from the list are finished. any_input (bool | None | Unset): Terminate output stream if any of the input streams ends. This includes streams
- added after the output was registered. In particular, output stream will not be terminated if no inputs were
- ever connected. all_inputs (bool | None | Unset): Terminate output stream if all the input streams finish. In particular, output
- stream will be terminated if no inputs were ever connected.
26def __init__(self, any_of=attr_dict['any_of'].default, all_of=attr_dict['all_of'].default, any_input=attr_dict['any_input'].default, all_inputs=attr_dict['all_inputs'].default): 27 self.any_of = any_of 28 self.all_of = all_of 29 self.any_input = any_input 30 self.all_inputs = all_inputs
Method generated by attrs for class OutputEndCondition.
40 def to_dict(self) -> dict[str, Any]: 41 any_of: list[str] | None | Unset 42 if isinstance(self.any_of, Unset): 43 any_of = UNSET 44 elif isinstance(self.any_of, list): 45 any_of = self.any_of 46 47 else: 48 any_of = self.any_of 49 50 all_of: list[str] | None | Unset 51 if isinstance(self.all_of, Unset): 52 all_of = UNSET 53 elif isinstance(self.all_of, list): 54 all_of = self.all_of 55 56 else: 57 all_of = self.all_of 58 59 any_input: bool | None | Unset 60 if isinstance(self.any_input, Unset): 61 any_input = UNSET 62 else: 63 any_input = self.any_input 64 65 all_inputs: bool | None | Unset 66 if isinstance(self.all_inputs, Unset): 67 all_inputs = UNSET 68 else: 69 all_inputs = self.all_inputs 70 71 field_dict: dict[str, Any] = {} 72 73 field_dict.update({}) 74 if any_of is not UNSET: 75 field_dict["any_of"] = any_of 76 if all_of is not UNSET: 77 field_dict["all_of"] = all_of 78 if any_input is not UNSET: 79 field_dict["any_input"] = any_input 80 if all_inputs is not UNSET: 81 field_dict["all_inputs"] = all_inputs 82 83 return field_dict
85 @classmethod 86 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 87 d = dict(src_dict) 88 89 def _parse_any_of(data: object) -> list[str] | None | Unset: 90 if data is None: 91 return data 92 if isinstance(data, Unset): 93 return data 94 try: 95 if not isinstance(data, list): 96 raise TypeError() 97 any_of_type_0 = cast(list[str], data) 98 99 return any_of_type_0 100 except (TypeError, ValueError, AttributeError, KeyError): 101 pass 102 return cast(list[str] | None | Unset, data) 103 104 any_of = _parse_any_of(d.pop("any_of", UNSET)) 105 106 def _parse_all_of(data: object) -> list[str] | None | Unset: 107 if data is None: 108 return data 109 if isinstance(data, Unset): 110 return data 111 try: 112 if not isinstance(data, list): 113 raise TypeError() 114 all_of_type_0 = cast(list[str], data) 115 116 return all_of_type_0 117 except (TypeError, ValueError, AttributeError, KeyError): 118 pass 119 return cast(list[str] | None | Unset, data) 120 121 all_of = _parse_all_of(d.pop("all_of", UNSET)) 122 123 def _parse_any_input(data: object) -> bool | None | Unset: 124 if data is None: 125 return data 126 if isinstance(data, Unset): 127 return data 128 return cast(bool | None | Unset, data) 129 130 any_input = _parse_any_input(d.pop("any_input", UNSET)) 131 132 def _parse_all_inputs(data: object) -> bool | None | Unset: 133 if data is None: 134 return data 135 if isinstance(data, Unset): 136 return data 137 return cast(bool | None | Unset, data) 138 139 all_inputs = _parse_all_inputs(d.pop("all_inputs", UNSET)) 140 141 output_end_condition = cls( 142 any_of=any_of, 143 all_of=all_of, 144 any_input=any_input, 145 all_inputs=all_inputs, 146 ) 147 148 return output_end_condition
21@_attrs_define 22class OutputRtmpClientAudioOptions: 23 """ 24 Attributes: 25 initial (AudioScene): 26 mixing_strategy (AudioMixingStrategy | None | Unset): 27 send_eos_when (None | OutputEndCondition | Unset): 28 channels (AudioChannels | None | Unset): 29 """ 30 31 initial: AudioScene 32 mixing_strategy: AudioMixingStrategy | None | Unset = UNSET 33 send_eos_when: None | OutputEndCondition | Unset = UNSET 34 channels: AudioChannels | None | Unset = UNSET 35 36 def to_dict(self) -> dict[str, Any]: 37 from ..models.output_end_condition import OutputEndCondition 38 39 initial = self.initial.to_dict() 40 41 mixing_strategy: None | str | Unset 42 if isinstance(self.mixing_strategy, Unset): 43 mixing_strategy = UNSET 44 elif isinstance(self.mixing_strategy, AudioMixingStrategy): 45 mixing_strategy = self.mixing_strategy.value 46 else: 47 mixing_strategy = self.mixing_strategy 48 49 send_eos_when: dict[str, Any] | None | Unset 50 if isinstance(self.send_eos_when, Unset): 51 send_eos_when = UNSET 52 elif isinstance(self.send_eos_when, OutputEndCondition): 53 send_eos_when = self.send_eos_when.to_dict() 54 else: 55 send_eos_when = self.send_eos_when 56 57 channels: None | str | Unset 58 if isinstance(self.channels, Unset): 59 channels = UNSET 60 elif isinstance(self.channels, AudioChannels): 61 channels = self.channels.value 62 else: 63 channels = self.channels 64 65 field_dict: dict[str, Any] = {} 66 67 field_dict.update({ 68 "initial": initial, 69 }) 70 if mixing_strategy is not UNSET: 71 field_dict["mixing_strategy"] = mixing_strategy 72 if send_eos_when is not UNSET: 73 field_dict["send_eos_when"] = send_eos_when 74 if channels is not UNSET: 75 field_dict["channels"] = channels 76 77 return field_dict 78 79 @classmethod 80 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 81 from ..models.audio_scene import AudioScene 82 from ..models.output_end_condition import OutputEndCondition 83 84 d = dict(src_dict) 85 initial = AudioScene.from_dict(d.pop("initial")) 86 87 def _parse_mixing_strategy(data: object) -> AudioMixingStrategy | None | Unset: 88 if data is None: 89 return data 90 if isinstance(data, Unset): 91 return data 92 try: 93 if not isinstance(data, str): 94 raise TypeError() 95 mixing_strategy_type_1 = AudioMixingStrategy(data) 96 97 return mixing_strategy_type_1 98 except (TypeError, ValueError, AttributeError, KeyError): 99 pass 100 return cast(AudioMixingStrategy | None | Unset, data) 101 102 mixing_strategy = _parse_mixing_strategy(d.pop("mixing_strategy", UNSET)) 103 104 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 105 if data is None: 106 return data 107 if isinstance(data, Unset): 108 return data 109 try: 110 if not isinstance(data, dict): 111 raise TypeError() 112 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 113 114 return send_eos_when_type_1 115 except (TypeError, ValueError, AttributeError, KeyError): 116 pass 117 return cast(None | OutputEndCondition | Unset, data) 118 119 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 120 121 def _parse_channels(data: object) -> AudioChannels | None | Unset: 122 if data is None: 123 return data 124 if isinstance(data, Unset): 125 return data 126 try: 127 if not isinstance(data, str): 128 raise TypeError() 129 channels_type_1 = AudioChannels(data) 130 131 return channels_type_1 132 except (TypeError, ValueError, AttributeError, KeyError): 133 pass 134 return cast(AudioChannels | None | Unset, data) 135 136 channels = _parse_channels(d.pop("channels", UNSET)) 137 138 output_rtmp_client_audio_options = cls( 139 initial=initial, 140 mixing_strategy=mixing_strategy, 141 send_eos_when=send_eos_when, 142 channels=channels, 143 ) 144 145 return output_rtmp_client_audio_options
Attributes:
- initial (AudioScene):
- mixing_strategy (AudioMixingStrategy | None | Unset):
- send_eos_when (None | OutputEndCondition | Unset):
- channels (AudioChannels | None | Unset):
26def __init__(self, initial, mixing_strategy=attr_dict['mixing_strategy'].default, send_eos_when=attr_dict['send_eos_when'].default, channels=attr_dict['channels'].default): 27 self.initial = initial 28 self.mixing_strategy = mixing_strategy 29 self.send_eos_when = send_eos_when 30 self.channels = channels
Method generated by attrs for class OutputRtmpClientAudioOptions.
36 def to_dict(self) -> dict[str, Any]: 37 from ..models.output_end_condition import OutputEndCondition 38 39 initial = self.initial.to_dict() 40 41 mixing_strategy: None | str | Unset 42 if isinstance(self.mixing_strategy, Unset): 43 mixing_strategy = UNSET 44 elif isinstance(self.mixing_strategy, AudioMixingStrategy): 45 mixing_strategy = self.mixing_strategy.value 46 else: 47 mixing_strategy = self.mixing_strategy 48 49 send_eos_when: dict[str, Any] | None | Unset 50 if isinstance(self.send_eos_when, Unset): 51 send_eos_when = UNSET 52 elif isinstance(self.send_eos_when, OutputEndCondition): 53 send_eos_when = self.send_eos_when.to_dict() 54 else: 55 send_eos_when = self.send_eos_when 56 57 channels: None | str | Unset 58 if isinstance(self.channels, Unset): 59 channels = UNSET 60 elif isinstance(self.channels, AudioChannels): 61 channels = self.channels.value 62 else: 63 channels = self.channels 64 65 field_dict: dict[str, Any] = {} 66 67 field_dict.update({ 68 "initial": initial, 69 }) 70 if mixing_strategy is not UNSET: 71 field_dict["mixing_strategy"] = mixing_strategy 72 if send_eos_when is not UNSET: 73 field_dict["send_eos_when"] = send_eos_when 74 if channels is not UNSET: 75 field_dict["channels"] = channels 76 77 return field_dict
79 @classmethod 80 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 81 from ..models.audio_scene import AudioScene 82 from ..models.output_end_condition import OutputEndCondition 83 84 d = dict(src_dict) 85 initial = AudioScene.from_dict(d.pop("initial")) 86 87 def _parse_mixing_strategy(data: object) -> AudioMixingStrategy | None | Unset: 88 if data is None: 89 return data 90 if isinstance(data, Unset): 91 return data 92 try: 93 if not isinstance(data, str): 94 raise TypeError() 95 mixing_strategy_type_1 = AudioMixingStrategy(data) 96 97 return mixing_strategy_type_1 98 except (TypeError, ValueError, AttributeError, KeyError): 99 pass 100 return cast(AudioMixingStrategy | None | Unset, data) 101 102 mixing_strategy = _parse_mixing_strategy(d.pop("mixing_strategy", UNSET)) 103 104 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 105 if data is None: 106 return data 107 if isinstance(data, Unset): 108 return data 109 try: 110 if not isinstance(data, dict): 111 raise TypeError() 112 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 113 114 return send_eos_when_type_1 115 except (TypeError, ValueError, AttributeError, KeyError): 116 pass 117 return cast(None | OutputEndCondition | Unset, data) 118 119 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 120 121 def _parse_channels(data: object) -> AudioChannels | None | Unset: 122 if data is None: 123 return data 124 if isinstance(data, Unset): 125 return data 126 try: 127 if not isinstance(data, str): 128 raise TypeError() 129 channels_type_1 = AudioChannels(data) 130 131 return channels_type_1 132 except (TypeError, ValueError, AttributeError, KeyError): 133 pass 134 return cast(AudioChannels | None | Unset, data) 135 136 channels = _parse_channels(d.pop("channels", UNSET)) 137 138 output_rtmp_client_audio_options = cls( 139 initial=initial, 140 mixing_strategy=mixing_strategy, 141 send_eos_when=send_eos_when, 142 channels=channels, 143 ) 144 145 return output_rtmp_client_audio_options
20@_attrs_define 21class OutputRtmpClientVideoOptions: 22 """ 23 Attributes: 24 resolution (Resolution): 25 initial (VideoScene): 26 send_eos_when (None | OutputEndCondition | Unset): 27 """ 28 29 resolution: Resolution 30 initial: VideoScene 31 send_eos_when: None | OutputEndCondition | Unset = UNSET 32 33 def to_dict(self) -> dict[str, Any]: 34 from ..models.output_end_condition import OutputEndCondition 35 36 resolution = self.resolution.to_dict() 37 38 initial = self.initial.to_dict() 39 40 send_eos_when: dict[str, Any] | None | Unset 41 if isinstance(self.send_eos_when, Unset): 42 send_eos_when = UNSET 43 elif isinstance(self.send_eos_when, OutputEndCondition): 44 send_eos_when = self.send_eos_when.to_dict() 45 else: 46 send_eos_when = self.send_eos_when 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "resolution": resolution, 52 "initial": initial, 53 }) 54 if send_eos_when is not UNSET: 55 field_dict["send_eos_when"] = send_eos_when 56 57 return field_dict 58 59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.output_end_condition import OutputEndCondition 62 from ..models.resolution import Resolution 63 from ..models.video_scene import VideoScene 64 65 d = dict(src_dict) 66 resolution = Resolution.from_dict(d.pop("resolution")) 67 68 initial = VideoScene.from_dict(d.pop("initial")) 69 70 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 71 if data is None: 72 return data 73 if isinstance(data, Unset): 74 return data 75 try: 76 if not isinstance(data, dict): 77 raise TypeError() 78 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 79 80 return send_eos_when_type_1 81 except (TypeError, ValueError, AttributeError, KeyError): 82 pass 83 return cast(None | OutputEndCondition | Unset, data) 84 85 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 86 87 output_rtmp_client_video_options = cls( 88 resolution=resolution, 89 initial=initial, 90 send_eos_when=send_eos_when, 91 ) 92 93 return output_rtmp_client_video_options
Attributes:
- resolution (Resolution):
- initial (VideoScene):
- send_eos_when (None | OutputEndCondition | Unset):
25def __init__(self, resolution, initial, send_eos_when=attr_dict['send_eos_when'].default): 26 self.resolution = resolution 27 self.initial = initial 28 self.send_eos_when = send_eos_when
Method generated by attrs for class OutputRtmpClientVideoOptions.
33 def to_dict(self) -> dict[str, Any]: 34 from ..models.output_end_condition import OutputEndCondition 35 36 resolution = self.resolution.to_dict() 37 38 initial = self.initial.to_dict() 39 40 send_eos_when: dict[str, Any] | None | Unset 41 if isinstance(self.send_eos_when, Unset): 42 send_eos_when = UNSET 43 elif isinstance(self.send_eos_when, OutputEndCondition): 44 send_eos_when = self.send_eos_when.to_dict() 45 else: 46 send_eos_when = self.send_eos_when 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "resolution": resolution, 52 "initial": initial, 53 }) 54 if send_eos_when is not UNSET: 55 field_dict["send_eos_when"] = send_eos_when 56 57 return field_dict
59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.output_end_condition import OutputEndCondition 62 from ..models.resolution import Resolution 63 from ..models.video_scene import VideoScene 64 65 d = dict(src_dict) 66 resolution = Resolution.from_dict(d.pop("resolution")) 67 68 initial = VideoScene.from_dict(d.pop("initial")) 69 70 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 71 if data is None: 72 return data 73 if isinstance(data, Unset): 74 return data 75 try: 76 if not isinstance(data, dict): 77 raise TypeError() 78 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 79 80 return send_eos_when_type_1 81 except (TypeError, ValueError, AttributeError, KeyError): 82 pass 83 return cast(None | OutputEndCondition | Unset, data) 84 85 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 86 87 output_rtmp_client_video_options = cls( 88 resolution=resolution, 89 initial=initial, 90 send_eos_when=send_eos_when, 91 ) 92 93 return output_rtmp_client_video_options
23@_attrs_define 24class OutputWhipAudioOptions: 25 """ 26 Attributes: 27 initial (AudioScene): 28 mixing_strategy (AudioMixingStrategy | None | Unset): 29 send_eos_when (None | OutputEndCondition | Unset): 30 channels (AudioChannels | None | Unset): 31 encoder_preferences (list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] | None | Unset): Codec 32 preferences list. 33 """ 34 35 initial: AudioScene 36 mixing_strategy: AudioMixingStrategy | None | Unset = UNSET 37 send_eos_when: None | OutputEndCondition | Unset = UNSET 38 channels: AudioChannels | None | Unset = UNSET 39 encoder_preferences: ( 40 list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] | None | Unset 41 ) = UNSET 42 43 def to_dict(self) -> dict[str, Any]: 44 from ..models.output_end_condition import OutputEndCondition 45 from ..models.whip_audio_encoder_options_opus import WhipAudioEncoderOptionsOpus 46 47 initial = self.initial.to_dict() 48 49 mixing_strategy: None | str | Unset 50 if isinstance(self.mixing_strategy, Unset): 51 mixing_strategy = UNSET 52 elif isinstance(self.mixing_strategy, AudioMixingStrategy): 53 mixing_strategy = self.mixing_strategy.value 54 else: 55 mixing_strategy = self.mixing_strategy 56 57 send_eos_when: dict[str, Any] | None | Unset 58 if isinstance(self.send_eos_when, Unset): 59 send_eos_when = UNSET 60 elif isinstance(self.send_eos_when, OutputEndCondition): 61 send_eos_when = self.send_eos_when.to_dict() 62 else: 63 send_eos_when = self.send_eos_when 64 65 channels: None | str | Unset 66 if isinstance(self.channels, Unset): 67 channels = UNSET 68 elif isinstance(self.channels, AudioChannels): 69 channels = self.channels.value 70 else: 71 channels = self.channels 72 73 encoder_preferences: list[dict[str, Any]] | None | Unset 74 if isinstance(self.encoder_preferences, Unset): 75 encoder_preferences = UNSET 76 elif isinstance(self.encoder_preferences, list): 77 encoder_preferences = [] 78 for encoder_preferences_type_0_item_data in self.encoder_preferences: 79 encoder_preferences_type_0_item: dict[str, Any] 80 if isinstance( 81 encoder_preferences_type_0_item_data, WhipAudioEncoderOptionsOpus 82 ): 83 encoder_preferences_type_0_item = ( 84 encoder_preferences_type_0_item_data.to_dict() 85 ) 86 else: 87 encoder_preferences_type_0_item = ( 88 encoder_preferences_type_0_item_data.to_dict() 89 ) 90 91 encoder_preferences.append(encoder_preferences_type_0_item) 92 93 else: 94 encoder_preferences = self.encoder_preferences 95 96 field_dict: dict[str, Any] = {} 97 98 field_dict.update({ 99 "initial": initial, 100 }) 101 if mixing_strategy is not UNSET: 102 field_dict["mixing_strategy"] = mixing_strategy 103 if send_eos_when is not UNSET: 104 field_dict["send_eos_when"] = send_eos_when 105 if channels is not UNSET: 106 field_dict["channels"] = channels 107 if encoder_preferences is not UNSET: 108 field_dict["encoder_preferences"] = encoder_preferences 109 110 return field_dict 111 112 @classmethod 113 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 114 from ..models.audio_scene import AudioScene 115 from ..models.output_end_condition import OutputEndCondition 116 from ..models.whip_audio_encoder_options_any import WhipAudioEncoderOptionsAny 117 from ..models.whip_audio_encoder_options_opus import WhipAudioEncoderOptionsOpus 118 119 d = dict(src_dict) 120 initial = AudioScene.from_dict(d.pop("initial")) 121 122 def _parse_mixing_strategy(data: object) -> AudioMixingStrategy | None | Unset: 123 if data is None: 124 return data 125 if isinstance(data, Unset): 126 return data 127 try: 128 if not isinstance(data, str): 129 raise TypeError() 130 mixing_strategy_type_1 = AudioMixingStrategy(data) 131 132 return mixing_strategy_type_1 133 except (TypeError, ValueError, AttributeError, KeyError): 134 pass 135 return cast(AudioMixingStrategy | None | Unset, data) 136 137 mixing_strategy = _parse_mixing_strategy(d.pop("mixing_strategy", UNSET)) 138 139 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 140 if data is None: 141 return data 142 if isinstance(data, Unset): 143 return data 144 try: 145 if not isinstance(data, dict): 146 raise TypeError() 147 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 148 149 return send_eos_when_type_1 150 except (TypeError, ValueError, AttributeError, KeyError): 151 pass 152 return cast(None | OutputEndCondition | Unset, data) 153 154 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 155 156 def _parse_channels(data: object) -> AudioChannels | None | Unset: 157 if data is None: 158 return data 159 if isinstance(data, Unset): 160 return data 161 try: 162 if not isinstance(data, str): 163 raise TypeError() 164 channels_type_1 = AudioChannels(data) 165 166 return channels_type_1 167 except (TypeError, ValueError, AttributeError, KeyError): 168 pass 169 return cast(AudioChannels | None | Unset, data) 170 171 channels = _parse_channels(d.pop("channels", UNSET)) 172 173 def _parse_encoder_preferences( 174 data: object, 175 ) -> ( 176 list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] 177 | None 178 | Unset 179 ): 180 if data is None: 181 return data 182 if isinstance(data, Unset): 183 return data 184 try: 185 if not isinstance(data, list): 186 raise TypeError() 187 encoder_preferences_type_0 = [] 188 _encoder_preferences_type_0 = data 189 for encoder_preferences_type_0_item_data in _encoder_preferences_type_0: 190 191 def _parse_encoder_preferences_type_0_item( 192 data: object, 193 ) -> WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus: 194 try: 195 if not isinstance(data, dict): 196 raise TypeError() 197 componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_opus = WhipAudioEncoderOptionsOpus.from_dict( 198 data 199 ) 200 201 return componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_opus 202 except (TypeError, ValueError, AttributeError, KeyError): 203 pass 204 if not isinstance(data, dict): 205 raise TypeError() 206 componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_any = WhipAudioEncoderOptionsAny.from_dict( 207 data 208 ) 209 210 return componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_any 211 212 encoder_preferences_type_0_item = ( 213 _parse_encoder_preferences_type_0_item( 214 encoder_preferences_type_0_item_data 215 ) 216 ) 217 218 encoder_preferences_type_0.append(encoder_preferences_type_0_item) 219 220 return encoder_preferences_type_0 221 except (TypeError, ValueError, AttributeError, KeyError): 222 pass 223 return cast( 224 list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] 225 | None 226 | Unset, 227 data, 228 ) 229 230 encoder_preferences = _parse_encoder_preferences( 231 d.pop("encoder_preferences", UNSET) 232 ) 233 234 output_whip_audio_options = cls( 235 initial=initial, 236 mixing_strategy=mixing_strategy, 237 send_eos_when=send_eos_when, 238 channels=channels, 239 encoder_preferences=encoder_preferences, 240 ) 241 242 return output_whip_audio_options
Attributes:
- initial (AudioScene):
- mixing_strategy (AudioMixingStrategy | None | Unset):
- send_eos_when (None | OutputEndCondition | Unset):
- channels (AudioChannels | None | Unset):
- encoder_preferences (list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] | None | Unset): Codec preferences list.
27def __init__(self, initial, mixing_strategy=attr_dict['mixing_strategy'].default, send_eos_when=attr_dict['send_eos_when'].default, channels=attr_dict['channels'].default, encoder_preferences=attr_dict['encoder_preferences'].default): 28 self.initial = initial 29 self.mixing_strategy = mixing_strategy 30 self.send_eos_when = send_eos_when 31 self.channels = channels 32 self.encoder_preferences = encoder_preferences
Method generated by attrs for class OutputWhipAudioOptions.
43 def to_dict(self) -> dict[str, Any]: 44 from ..models.output_end_condition import OutputEndCondition 45 from ..models.whip_audio_encoder_options_opus import WhipAudioEncoderOptionsOpus 46 47 initial = self.initial.to_dict() 48 49 mixing_strategy: None | str | Unset 50 if isinstance(self.mixing_strategy, Unset): 51 mixing_strategy = UNSET 52 elif isinstance(self.mixing_strategy, AudioMixingStrategy): 53 mixing_strategy = self.mixing_strategy.value 54 else: 55 mixing_strategy = self.mixing_strategy 56 57 send_eos_when: dict[str, Any] | None | Unset 58 if isinstance(self.send_eos_when, Unset): 59 send_eos_when = UNSET 60 elif isinstance(self.send_eos_when, OutputEndCondition): 61 send_eos_when = self.send_eos_when.to_dict() 62 else: 63 send_eos_when = self.send_eos_when 64 65 channels: None | str | Unset 66 if isinstance(self.channels, Unset): 67 channels = UNSET 68 elif isinstance(self.channels, AudioChannels): 69 channels = self.channels.value 70 else: 71 channels = self.channels 72 73 encoder_preferences: list[dict[str, Any]] | None | Unset 74 if isinstance(self.encoder_preferences, Unset): 75 encoder_preferences = UNSET 76 elif isinstance(self.encoder_preferences, list): 77 encoder_preferences = [] 78 for encoder_preferences_type_0_item_data in self.encoder_preferences: 79 encoder_preferences_type_0_item: dict[str, Any] 80 if isinstance( 81 encoder_preferences_type_0_item_data, WhipAudioEncoderOptionsOpus 82 ): 83 encoder_preferences_type_0_item = ( 84 encoder_preferences_type_0_item_data.to_dict() 85 ) 86 else: 87 encoder_preferences_type_0_item = ( 88 encoder_preferences_type_0_item_data.to_dict() 89 ) 90 91 encoder_preferences.append(encoder_preferences_type_0_item) 92 93 else: 94 encoder_preferences = self.encoder_preferences 95 96 field_dict: dict[str, Any] = {} 97 98 field_dict.update({ 99 "initial": initial, 100 }) 101 if mixing_strategy is not UNSET: 102 field_dict["mixing_strategy"] = mixing_strategy 103 if send_eos_when is not UNSET: 104 field_dict["send_eos_when"] = send_eos_when 105 if channels is not UNSET: 106 field_dict["channels"] = channels 107 if encoder_preferences is not UNSET: 108 field_dict["encoder_preferences"] = encoder_preferences 109 110 return field_dict
112 @classmethod 113 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 114 from ..models.audio_scene import AudioScene 115 from ..models.output_end_condition import OutputEndCondition 116 from ..models.whip_audio_encoder_options_any import WhipAudioEncoderOptionsAny 117 from ..models.whip_audio_encoder_options_opus import WhipAudioEncoderOptionsOpus 118 119 d = dict(src_dict) 120 initial = AudioScene.from_dict(d.pop("initial")) 121 122 def _parse_mixing_strategy(data: object) -> AudioMixingStrategy | None | Unset: 123 if data is None: 124 return data 125 if isinstance(data, Unset): 126 return data 127 try: 128 if not isinstance(data, str): 129 raise TypeError() 130 mixing_strategy_type_1 = AudioMixingStrategy(data) 131 132 return mixing_strategy_type_1 133 except (TypeError, ValueError, AttributeError, KeyError): 134 pass 135 return cast(AudioMixingStrategy | None | Unset, data) 136 137 mixing_strategy = _parse_mixing_strategy(d.pop("mixing_strategy", UNSET)) 138 139 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 140 if data is None: 141 return data 142 if isinstance(data, Unset): 143 return data 144 try: 145 if not isinstance(data, dict): 146 raise TypeError() 147 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 148 149 return send_eos_when_type_1 150 except (TypeError, ValueError, AttributeError, KeyError): 151 pass 152 return cast(None | OutputEndCondition | Unset, data) 153 154 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 155 156 def _parse_channels(data: object) -> AudioChannels | None | Unset: 157 if data is None: 158 return data 159 if isinstance(data, Unset): 160 return data 161 try: 162 if not isinstance(data, str): 163 raise TypeError() 164 channels_type_1 = AudioChannels(data) 165 166 return channels_type_1 167 except (TypeError, ValueError, AttributeError, KeyError): 168 pass 169 return cast(AudioChannels | None | Unset, data) 170 171 channels = _parse_channels(d.pop("channels", UNSET)) 172 173 def _parse_encoder_preferences( 174 data: object, 175 ) -> ( 176 list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] 177 | None 178 | Unset 179 ): 180 if data is None: 181 return data 182 if isinstance(data, Unset): 183 return data 184 try: 185 if not isinstance(data, list): 186 raise TypeError() 187 encoder_preferences_type_0 = [] 188 _encoder_preferences_type_0 = data 189 for encoder_preferences_type_0_item_data in _encoder_preferences_type_0: 190 191 def _parse_encoder_preferences_type_0_item( 192 data: object, 193 ) -> WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus: 194 try: 195 if not isinstance(data, dict): 196 raise TypeError() 197 componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_opus = WhipAudioEncoderOptionsOpus.from_dict( 198 data 199 ) 200 201 return componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_opus 202 except (TypeError, ValueError, AttributeError, KeyError): 203 pass 204 if not isinstance(data, dict): 205 raise TypeError() 206 componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_any = WhipAudioEncoderOptionsAny.from_dict( 207 data 208 ) 209 210 return componentsschemas_whip_audio_encoder_options_whip_audio_encoder_options_any 211 212 encoder_preferences_type_0_item = ( 213 _parse_encoder_preferences_type_0_item( 214 encoder_preferences_type_0_item_data 215 ) 216 ) 217 218 encoder_preferences_type_0.append(encoder_preferences_type_0_item) 219 220 return encoder_preferences_type_0 221 except (TypeError, ValueError, AttributeError, KeyError): 222 pass 223 return cast( 224 list[WhipAudioEncoderOptionsAny | WhipAudioEncoderOptionsOpus] 225 | None 226 | Unset, 227 data, 228 ) 229 230 encoder_preferences = _parse_encoder_preferences( 231 d.pop("encoder_preferences", UNSET) 232 ) 233 234 output_whip_audio_options = cls( 235 initial=initial, 236 mixing_strategy=mixing_strategy, 237 send_eos_when=send_eos_when, 238 channels=channels, 239 encoder_preferences=encoder_preferences, 240 ) 241 242 return output_whip_audio_options
20@_attrs_define 21class OutputWhipVideoOptions: 22 """ 23 Attributes: 24 resolution (Resolution): 25 initial (VideoScene): 26 send_eos_when (None | OutputEndCondition | Unset): 27 """ 28 29 resolution: Resolution 30 initial: VideoScene 31 send_eos_when: None | OutputEndCondition | Unset = UNSET 32 33 def to_dict(self) -> dict[str, Any]: 34 from ..models.output_end_condition import OutputEndCondition 35 36 resolution = self.resolution.to_dict() 37 38 initial = self.initial.to_dict() 39 40 send_eos_when: dict[str, Any] | None | Unset 41 if isinstance(self.send_eos_when, Unset): 42 send_eos_when = UNSET 43 elif isinstance(self.send_eos_when, OutputEndCondition): 44 send_eos_when = self.send_eos_when.to_dict() 45 else: 46 send_eos_when = self.send_eos_when 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "resolution": resolution, 52 "initial": initial, 53 }) 54 if send_eos_when is not UNSET: 55 field_dict["send_eos_when"] = send_eos_when 56 57 return field_dict 58 59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.output_end_condition import OutputEndCondition 62 from ..models.resolution import Resolution 63 from ..models.video_scene import VideoScene 64 65 d = dict(src_dict) 66 resolution = Resolution.from_dict(d.pop("resolution")) 67 68 initial = VideoScene.from_dict(d.pop("initial")) 69 70 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 71 if data is None: 72 return data 73 if isinstance(data, Unset): 74 return data 75 try: 76 if not isinstance(data, dict): 77 raise TypeError() 78 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 79 80 return send_eos_when_type_1 81 except (TypeError, ValueError, AttributeError, KeyError): 82 pass 83 return cast(None | OutputEndCondition | Unset, data) 84 85 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 86 87 output_whip_video_options = cls( 88 resolution=resolution, 89 initial=initial, 90 send_eos_when=send_eos_when, 91 ) 92 93 return output_whip_video_options
Attributes:
- resolution (Resolution):
- initial (VideoScene):
- send_eos_when (None | OutputEndCondition | Unset):
25def __init__(self, resolution, initial, send_eos_when=attr_dict['send_eos_when'].default): 26 self.resolution = resolution 27 self.initial = initial 28 self.send_eos_when = send_eos_when
Method generated by attrs for class OutputWhipVideoOptions.
33 def to_dict(self) -> dict[str, Any]: 34 from ..models.output_end_condition import OutputEndCondition 35 36 resolution = self.resolution.to_dict() 37 38 initial = self.initial.to_dict() 39 40 send_eos_when: dict[str, Any] | None | Unset 41 if isinstance(self.send_eos_when, Unset): 42 send_eos_when = UNSET 43 elif isinstance(self.send_eos_when, OutputEndCondition): 44 send_eos_when = self.send_eos_when.to_dict() 45 else: 46 send_eos_when = self.send_eos_when 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "resolution": resolution, 52 "initial": initial, 53 }) 54 if send_eos_when is not UNSET: 55 field_dict["send_eos_when"] = send_eos_when 56 57 return field_dict
59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.output_end_condition import OutputEndCondition 62 from ..models.resolution import Resolution 63 from ..models.video_scene import VideoScene 64 65 d = dict(src_dict) 66 resolution = Resolution.from_dict(d.pop("resolution")) 67 68 initial = VideoScene.from_dict(d.pop("initial")) 69 70 def _parse_send_eos_when(data: object) -> None | OutputEndCondition | Unset: 71 if data is None: 72 return data 73 if isinstance(data, Unset): 74 return data 75 try: 76 if not isinstance(data, dict): 77 raise TypeError() 78 send_eos_when_type_1 = OutputEndCondition.from_dict(data) 79 80 return send_eos_when_type_1 81 except (TypeError, ValueError, AttributeError, KeyError): 82 pass 83 return cast(None | OutputEndCondition | Unset, data) 84 85 send_eos_when = _parse_send_eos_when(d.pop("send_eos_when", UNSET)) 86 87 output_whip_video_options = cls( 88 resolution=resolution, 89 initial=initial, 90 send_eos_when=send_eos_when, 91 ) 92 93 return output_whip_video_options
5class Overflow(str, Enum): 6 """None""" 7 8 FIT = "fit" 9 HIDDEN = "hidden" 10 VISIBLE = "visible" 11 12 def __str__(self) -> str: 13 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class PixelFormat(str, Enum): 6 """None""" 7 8 YUV420P = "yuv420p" 9 YUV422P = "yuv422p" 10 YUV444P = "yuv444p" 11 12 def __str__(self) -> str: 13 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
14@_attrs_define 15class RegisterInputResponse: 16 """ 17 Attributes: 18 bearer_token (None | str | Unset): 19 endpoint_route (None | str | Unset): 20 video_duration_ms (int | None | Unset): 21 audio_duration_ms (int | None | Unset): 22 publish_url (None | str | Unset): 23 """ 24 25 bearer_token: None | str | Unset = UNSET 26 endpoint_route: None | str | Unset = UNSET 27 video_duration_ms: int | None | Unset = UNSET 28 audio_duration_ms: int | None | Unset = UNSET 29 publish_url: None | str | Unset = UNSET 30 31 def to_dict(self) -> dict[str, Any]: 32 bearer_token: None | str | Unset 33 if isinstance(self.bearer_token, Unset): 34 bearer_token = UNSET 35 else: 36 bearer_token = self.bearer_token 37 38 endpoint_route: None | str | Unset 39 if isinstance(self.endpoint_route, Unset): 40 endpoint_route = UNSET 41 else: 42 endpoint_route = self.endpoint_route 43 44 video_duration_ms: int | None | Unset 45 if isinstance(self.video_duration_ms, Unset): 46 video_duration_ms = UNSET 47 else: 48 video_duration_ms = self.video_duration_ms 49 50 audio_duration_ms: int | None | Unset 51 if isinstance(self.audio_duration_ms, Unset): 52 audio_duration_ms = UNSET 53 else: 54 audio_duration_ms = self.audio_duration_ms 55 56 publish_url: None | str | Unset 57 if isinstance(self.publish_url, Unset): 58 publish_url = UNSET 59 else: 60 publish_url = self.publish_url 61 62 field_dict: dict[str, Any] = {} 63 64 field_dict.update({}) 65 if bearer_token is not UNSET: 66 field_dict["bearer_token"] = bearer_token 67 if endpoint_route is not UNSET: 68 field_dict["endpoint_route"] = endpoint_route 69 if video_duration_ms is not UNSET: 70 field_dict["video_duration_ms"] = video_duration_ms 71 if audio_duration_ms is not UNSET: 72 field_dict["audio_duration_ms"] = audio_duration_ms 73 if publish_url is not UNSET: 74 field_dict["publish_url"] = publish_url 75 76 return field_dict 77 78 @classmethod 79 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 80 d = dict(src_dict) 81 82 def _parse_bearer_token(data: object) -> None | str | Unset: 83 if data is None: 84 return data 85 if isinstance(data, Unset): 86 return data 87 return cast(None | str | Unset, data) 88 89 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 90 91 def _parse_endpoint_route(data: object) -> None | str | Unset: 92 if data is None: 93 return data 94 if isinstance(data, Unset): 95 return data 96 return cast(None | str | Unset, data) 97 98 endpoint_route = _parse_endpoint_route(d.pop("endpoint_route", UNSET)) 99 100 def _parse_video_duration_ms(data: object) -> int | None | Unset: 101 if data is None: 102 return data 103 if isinstance(data, Unset): 104 return data 105 return cast(int | None | Unset, data) 106 107 video_duration_ms = _parse_video_duration_ms(d.pop("video_duration_ms", UNSET)) 108 109 def _parse_audio_duration_ms(data: object) -> int | None | Unset: 110 if data is None: 111 return data 112 if isinstance(data, Unset): 113 return data 114 return cast(int | None | Unset, data) 115 116 audio_duration_ms = _parse_audio_duration_ms(d.pop("audio_duration_ms", UNSET)) 117 118 def _parse_publish_url(data: object) -> None | str | Unset: 119 if data is None: 120 return data 121 if isinstance(data, Unset): 122 return data 123 return cast(None | str | Unset, data) 124 125 publish_url = _parse_publish_url(d.pop("publish_url", UNSET)) 126 127 register_input_response = cls( 128 bearer_token=bearer_token, 129 endpoint_route=endpoint_route, 130 video_duration_ms=video_duration_ms, 131 audio_duration_ms=audio_duration_ms, 132 publish_url=publish_url, 133 ) 134 135 return register_input_response
Attributes:
- bearer_token (None | str | Unset):
- endpoint_route (None | str | Unset):
- video_duration_ms (int | None | Unset):
- audio_duration_ms (int | None | Unset):
- publish_url (None | str | Unset):
27def __init__(self, bearer_token=attr_dict['bearer_token'].default, endpoint_route=attr_dict['endpoint_route'].default, video_duration_ms=attr_dict['video_duration_ms'].default, audio_duration_ms=attr_dict['audio_duration_ms'].default, publish_url=attr_dict['publish_url'].default): 28 self.bearer_token = bearer_token 29 self.endpoint_route = endpoint_route 30 self.video_duration_ms = video_duration_ms 31 self.audio_duration_ms = audio_duration_ms 32 self.publish_url = publish_url
Method generated by attrs for class RegisterInputResponse.
31 def to_dict(self) -> dict[str, Any]: 32 bearer_token: None | str | Unset 33 if isinstance(self.bearer_token, Unset): 34 bearer_token = UNSET 35 else: 36 bearer_token = self.bearer_token 37 38 endpoint_route: None | str | Unset 39 if isinstance(self.endpoint_route, Unset): 40 endpoint_route = UNSET 41 else: 42 endpoint_route = self.endpoint_route 43 44 video_duration_ms: int | None | Unset 45 if isinstance(self.video_duration_ms, Unset): 46 video_duration_ms = UNSET 47 else: 48 video_duration_ms = self.video_duration_ms 49 50 audio_duration_ms: int | None | Unset 51 if isinstance(self.audio_duration_ms, Unset): 52 audio_duration_ms = UNSET 53 else: 54 audio_duration_ms = self.audio_duration_ms 55 56 publish_url: None | str | Unset 57 if isinstance(self.publish_url, Unset): 58 publish_url = UNSET 59 else: 60 publish_url = self.publish_url 61 62 field_dict: dict[str, Any] = {} 63 64 field_dict.update({}) 65 if bearer_token is not UNSET: 66 field_dict["bearer_token"] = bearer_token 67 if endpoint_route is not UNSET: 68 field_dict["endpoint_route"] = endpoint_route 69 if video_duration_ms is not UNSET: 70 field_dict["video_duration_ms"] = video_duration_ms 71 if audio_duration_ms is not UNSET: 72 field_dict["audio_duration_ms"] = audio_duration_ms 73 if publish_url is not UNSET: 74 field_dict["publish_url"] = publish_url 75 76 return field_dict
78 @classmethod 79 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 80 d = dict(src_dict) 81 82 def _parse_bearer_token(data: object) -> None | str | Unset: 83 if data is None: 84 return data 85 if isinstance(data, Unset): 86 return data 87 return cast(None | str | Unset, data) 88 89 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 90 91 def _parse_endpoint_route(data: object) -> None | str | Unset: 92 if data is None: 93 return data 94 if isinstance(data, Unset): 95 return data 96 return cast(None | str | Unset, data) 97 98 endpoint_route = _parse_endpoint_route(d.pop("endpoint_route", UNSET)) 99 100 def _parse_video_duration_ms(data: object) -> int | None | Unset: 101 if data is None: 102 return data 103 if isinstance(data, Unset): 104 return data 105 return cast(int | None | Unset, data) 106 107 video_duration_ms = _parse_video_duration_ms(d.pop("video_duration_ms", UNSET)) 108 109 def _parse_audio_duration_ms(data: object) -> int | None | Unset: 110 if data is None: 111 return data 112 if isinstance(data, Unset): 113 return data 114 return cast(int | None | Unset, data) 115 116 audio_duration_ms = _parse_audio_duration_ms(d.pop("audio_duration_ms", UNSET)) 117 118 def _parse_publish_url(data: object) -> None | str | Unset: 119 if data is None: 120 return data 121 if isinstance(data, Unset): 122 return data 123 return cast(None | str | Unset, data) 124 125 publish_url = _parse_publish_url(d.pop("publish_url", UNSET)) 126 127 register_input_response = cls( 128 bearer_token=bearer_token, 129 endpoint_route=endpoint_route, 130 video_duration_ms=video_duration_ms, 131 audio_duration_ms=audio_duration_ms, 132 publish_url=publish_url, 133 ) 134 135 return register_input_response
21@_attrs_define 22class RegisterTemplateOutput: 23 """ 24 Attributes: 25 config (RtmpOutput | WhipOutput): 26 template (File): 27 """ 28 29 config: RtmpOutput | WhipOutput 30 template: File 31 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 32 33 def to_dict(self) -> dict[str, Any]: 34 from ..models.rtmp_output import RtmpOutput 35 36 config: dict[str, Any] 37 if isinstance(self.config, RtmpOutput): 38 config = self.config.to_dict() 39 else: 40 config = self.config.to_dict() 41 42 template = self.template.to_tuple() 43 44 field_dict: dict[str, Any] = {} 45 field_dict.update(self.additional_properties) 46 field_dict.update({ 47 "config": config, 48 "template": template, 49 }) 50 51 return field_dict 52 53 @classmethod 54 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 55 from ..models.rtmp_output import RtmpOutput 56 from ..models.whip_output import WhipOutput 57 58 d = dict(src_dict) 59 60 def _parse_config(data: object) -> RtmpOutput | WhipOutput: 61 try: 62 if not isinstance(data, dict): 63 raise TypeError() 64 componentsschemas_register_output_type_0 = RtmpOutput.from_dict(data) 65 66 return componentsschemas_register_output_type_0 67 except (TypeError, ValueError, AttributeError, KeyError): 68 pass 69 if not isinstance(data, dict): 70 raise TypeError() 71 componentsschemas_register_output_type_1 = WhipOutput.from_dict(data) 72 73 return componentsschemas_register_output_type_1 74 75 config = _parse_config(d.pop("config")) 76 77 template = File(payload=BytesIO(d.pop("template"))) 78 79 register_template_output = cls( 80 config=config, 81 template=template, 82 ) 83 84 register_template_output.additional_properties = d 85 return register_template_output 86 87 @property 88 def additional_keys(self) -> list[str]: 89 return list(self.additional_properties.keys()) 90 91 def __getitem__(self, key: str) -> Any: 92 return self.additional_properties[key] 93 94 def __setitem__(self, key: str, value: Any) -> None: 95 self.additional_properties[key] = value 96 97 def __delitem__(self, key: str) -> None: 98 del self.additional_properties[key] 99 100 def __contains__(self, key: str) -> bool: 101 return key in self.additional_properties
Attributes:
- config (RtmpOutput | WhipOutput):
- template (File):
25def __init__(self, config, template): 26 self.config = config 27 self.template = template 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class RegisterTemplateOutput.
33 def to_dict(self) -> dict[str, Any]: 34 from ..models.rtmp_output import RtmpOutput 35 36 config: dict[str, Any] 37 if isinstance(self.config, RtmpOutput): 38 config = self.config.to_dict() 39 else: 40 config = self.config.to_dict() 41 42 template = self.template.to_tuple() 43 44 field_dict: dict[str, Any] = {} 45 field_dict.update(self.additional_properties) 46 field_dict.update({ 47 "config": config, 48 "template": template, 49 }) 50 51 return field_dict
53 @classmethod 54 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 55 from ..models.rtmp_output import RtmpOutput 56 from ..models.whip_output import WhipOutput 57 58 d = dict(src_dict) 59 60 def _parse_config(data: object) -> RtmpOutput | WhipOutput: 61 try: 62 if not isinstance(data, dict): 63 raise TypeError() 64 componentsschemas_register_output_type_0 = RtmpOutput.from_dict(data) 65 66 return componentsschemas_register_output_type_0 67 except (TypeError, ValueError, AttributeError, KeyError): 68 pass 69 if not isinstance(data, dict): 70 raise TypeError() 71 componentsschemas_register_output_type_1 = WhipOutput.from_dict(data) 72 73 return componentsschemas_register_output_type_1 74 75 config = _parse_config(d.pop("config")) 76 77 template = File(payload=BytesIO(d.pop("template"))) 78 79 register_template_output = cls( 80 config=config, 81 template=template, 82 ) 83 84 register_template_output.additional_properties = d 85 return register_template_output
5class RescaleMode(str, Enum): 6 """None""" 7 8 FILL = "fill" 9 FIT = "fit" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
28@_attrs_define 29class Rescaler: 30 """ 31 Attributes: 32 child (Image | InputStream | Rescaler | Text | Tiles | View): 33 type_ (RescalerType): 34 id (None | str | Unset): 35 mode (None | RescaleMode | Unset): 36 horizontal_align (HorizontalAlign | None | Unset): 37 vertical_align (None | Unset | VerticalAlign): 38 width (float | None | Unset): Width of a component in pixels (without a border). Exact behavior might be 39 different 40 based on the parent component: 41 - If the parent component is a layout, check sections "Absolute positioning" and "Static 42 positioning" of that component. 43 - If the parent component is not a layout, then this field is required. 44 height (float | None | Unset): Height of a component in pixels (without a border). Exact behavior might be 45 different 46 based on the parent component: 47 - If the parent component is a layout, check sections "Absolute positioning" and "Static 48 positioning" of that component. 49 - If the parent component is not a layout, then this field is required. 50 top (float | None | Unset): Distance in pixels between this component's top edge and its parent's top edge 51 (including a border). 52 If this field is defined, then the component will ignore a layout defined by its parent. 53 left (float | None | Unset): Distance in pixels between this component's left edge and its parent's left edge 54 (including a border). 55 If this field is defined, this element will be absolutely positioned, instead of being 56 laid out by its parent. 57 bottom (float | None | Unset): Distance in pixels between the bottom edge of this component and the bottom edge 58 of its 59 parent (including a border). If this field is defined, this element will be absolutely 60 positioned, instead of being laid out by its parent. 61 right (float | None | Unset): Distance in pixels between this component's right edge and its parent's right 62 edge. 63 If this field is defined, this element will be absolutely positioned, instead of being 64 laid out by its parent. 65 rotation (float | None | Unset): Rotation of a component in degrees. If this field is defined, this element will 66 be 67 absolutely positioned, instead of being laid out by its parent. 68 transition (None | Transition | Unset): 69 border_radius (float | None | Unset): (**default=`0.0`**) Radius of a rounded corner. 70 border_width (float | None | Unset): (**default=`0.0`**) Border width. 71 border_color (None | str | Unset): 72 box_shadow (list[BoxShadow] | None | Unset): List of box shadows. 73 """ 74 75 child: Image | InputStream | Rescaler | Text | Tiles | View 76 type_: RescalerType 77 id: None | str | Unset = UNSET 78 mode: None | RescaleMode | Unset = UNSET 79 horizontal_align: HorizontalAlign | None | Unset = UNSET 80 vertical_align: None | Unset | VerticalAlign = UNSET 81 width: float | None | Unset = UNSET 82 height: float | None | Unset = UNSET 83 top: float | None | Unset = UNSET 84 left: float | None | Unset = UNSET 85 bottom: float | None | Unset = UNSET 86 right: float | None | Unset = UNSET 87 rotation: float | None | Unset = UNSET 88 transition: None | Transition | Unset = UNSET 89 border_radius: float | None | Unset = UNSET 90 border_width: float | None | Unset = UNSET 91 border_color: None | str | Unset = UNSET 92 box_shadow: list[BoxShadow] | None | Unset = UNSET 93 94 def to_dict(self) -> dict[str, Any]: 95 from ..models.input_stream import InputStream 96 from ..models.text import Text 97 from ..models.tiles import Tiles 98 from ..models.transition import Transition 99 from ..models.view import View 100 101 child: dict[str, Any] 102 if isinstance(self.child, InputStream): 103 child = self.child.to_dict() 104 elif isinstance(self.child, View): 105 child = self.child.to_dict() 106 elif isinstance(self.child, Text): 107 child = self.child.to_dict() 108 elif isinstance(self.child, Tiles): 109 child = self.child.to_dict() 110 elif isinstance(self.child, Rescaler): 111 child = self.child.to_dict() 112 else: 113 child = self.child.to_dict() 114 115 type_ = self.type_.value 116 117 id: None | str | Unset 118 if isinstance(self.id, Unset): 119 id = UNSET 120 else: 121 id = self.id 122 123 mode: None | str | Unset 124 if isinstance(self.mode, Unset): 125 mode = UNSET 126 elif isinstance(self.mode, RescaleMode): 127 mode = self.mode.value 128 else: 129 mode = self.mode 130 131 horizontal_align: None | str | Unset 132 if isinstance(self.horizontal_align, Unset): 133 horizontal_align = UNSET 134 elif isinstance(self.horizontal_align, HorizontalAlign): 135 horizontal_align = self.horizontal_align.value 136 else: 137 horizontal_align = self.horizontal_align 138 139 vertical_align: None | str | Unset 140 if isinstance(self.vertical_align, Unset): 141 vertical_align = UNSET 142 elif isinstance(self.vertical_align, VerticalAlign): 143 vertical_align = self.vertical_align.value 144 else: 145 vertical_align = self.vertical_align 146 147 width: float | None | Unset 148 if isinstance(self.width, Unset): 149 width = UNSET 150 else: 151 width = self.width 152 153 height: float | None | Unset 154 if isinstance(self.height, Unset): 155 height = UNSET 156 else: 157 height = self.height 158 159 top: float | None | Unset 160 if isinstance(self.top, Unset): 161 top = UNSET 162 else: 163 top = self.top 164 165 left: float | None | Unset 166 if isinstance(self.left, Unset): 167 left = UNSET 168 else: 169 left = self.left 170 171 bottom: float | None | Unset 172 if isinstance(self.bottom, Unset): 173 bottom = UNSET 174 else: 175 bottom = self.bottom 176 177 right: float | None | Unset 178 if isinstance(self.right, Unset): 179 right = UNSET 180 else: 181 right = self.right 182 183 rotation: float | None | Unset 184 if isinstance(self.rotation, Unset): 185 rotation = UNSET 186 else: 187 rotation = self.rotation 188 189 transition: dict[str, Any] | None | Unset 190 if isinstance(self.transition, Unset): 191 transition = UNSET 192 elif isinstance(self.transition, Transition): 193 transition = self.transition.to_dict() 194 else: 195 transition = self.transition 196 197 border_radius: float | None | Unset 198 if isinstance(self.border_radius, Unset): 199 border_radius = UNSET 200 else: 201 border_radius = self.border_radius 202 203 border_width: float | None | Unset 204 if isinstance(self.border_width, Unset): 205 border_width = UNSET 206 else: 207 border_width = self.border_width 208 209 border_color: None | str | Unset 210 if isinstance(self.border_color, Unset): 211 border_color = UNSET 212 else: 213 border_color = self.border_color 214 215 box_shadow: list[dict[str, Any]] | None | Unset 216 if isinstance(self.box_shadow, Unset): 217 box_shadow = UNSET 218 elif isinstance(self.box_shadow, list): 219 box_shadow = [] 220 for box_shadow_type_0_item_data in self.box_shadow: 221 box_shadow_type_0_item = box_shadow_type_0_item_data.to_dict() 222 box_shadow.append(box_shadow_type_0_item) 223 224 else: 225 box_shadow = self.box_shadow 226 227 field_dict: dict[str, Any] = {} 228 229 field_dict.update({ 230 "child": child, 231 "type": type_, 232 }) 233 if id is not UNSET: 234 field_dict["id"] = id 235 if mode is not UNSET: 236 field_dict["mode"] = mode 237 if horizontal_align is not UNSET: 238 field_dict["horizontal_align"] = horizontal_align 239 if vertical_align is not UNSET: 240 field_dict["vertical_align"] = vertical_align 241 if width is not UNSET: 242 field_dict["width"] = width 243 if height is not UNSET: 244 field_dict["height"] = height 245 if top is not UNSET: 246 field_dict["top"] = top 247 if left is not UNSET: 248 field_dict["left"] = left 249 if bottom is not UNSET: 250 field_dict["bottom"] = bottom 251 if right is not UNSET: 252 field_dict["right"] = right 253 if rotation is not UNSET: 254 field_dict["rotation"] = rotation 255 if transition is not UNSET: 256 field_dict["transition"] = transition 257 if border_radius is not UNSET: 258 field_dict["border_radius"] = border_radius 259 if border_width is not UNSET: 260 field_dict["border_width"] = border_width 261 if border_color is not UNSET: 262 field_dict["border_color"] = border_color 263 if box_shadow is not UNSET: 264 field_dict["box_shadow"] = box_shadow 265 266 return field_dict 267 268 @classmethod 269 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 270 from ..models.box_shadow import BoxShadow 271 from ..models.image import Image 272 from ..models.input_stream import InputStream 273 from ..models.text import Text 274 from ..models.tiles import Tiles 275 from ..models.transition import Transition 276 from ..models.view import View 277 278 d = dict(src_dict) 279 280 def _parse_child( 281 data: object, 282 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 283 try: 284 if not isinstance(data, dict): 285 raise TypeError() 286 componentsschemas_component_type_0 = InputStream.from_dict(data) 287 288 return componentsschemas_component_type_0 289 except (TypeError, ValueError, AttributeError, KeyError): 290 pass 291 try: 292 if not isinstance(data, dict): 293 raise TypeError() 294 componentsschemas_component_type_1 = View.from_dict(data) 295 296 return componentsschemas_component_type_1 297 except (TypeError, ValueError, AttributeError, KeyError): 298 pass 299 try: 300 if not isinstance(data, dict): 301 raise TypeError() 302 componentsschemas_component_type_2 = Text.from_dict(data) 303 304 return componentsschemas_component_type_2 305 except (TypeError, ValueError, AttributeError, KeyError): 306 pass 307 try: 308 if not isinstance(data, dict): 309 raise TypeError() 310 componentsschemas_component_type_3 = Tiles.from_dict(data) 311 312 return componentsschemas_component_type_3 313 except (TypeError, ValueError, AttributeError, KeyError): 314 pass 315 try: 316 if not isinstance(data, dict): 317 raise TypeError() 318 componentsschemas_component_type_4 = Rescaler.from_dict(data) 319 320 return componentsschemas_component_type_4 321 except (TypeError, ValueError, AttributeError, KeyError): 322 pass 323 if not isinstance(data, dict): 324 raise TypeError() 325 componentsschemas_component_type_5 = Image.from_dict(data) 326 327 return componentsschemas_component_type_5 328 329 child = _parse_child(d.pop("child")) 330 331 type_ = RescalerType(d.pop("type")) 332 333 def _parse_id(data: object) -> None | str | Unset: 334 if data is None: 335 return data 336 if isinstance(data, Unset): 337 return data 338 return cast(None | str | Unset, data) 339 340 id = _parse_id(d.pop("id", UNSET)) 341 342 def _parse_mode(data: object) -> None | RescaleMode | Unset: 343 if data is None: 344 return data 345 if isinstance(data, Unset): 346 return data 347 try: 348 if not isinstance(data, str): 349 raise TypeError() 350 mode_type_1 = RescaleMode(data) 351 352 return mode_type_1 353 except (TypeError, ValueError, AttributeError, KeyError): 354 pass 355 return cast(None | RescaleMode | Unset, data) 356 357 mode = _parse_mode(d.pop("mode", UNSET)) 358 359 def _parse_horizontal_align(data: object) -> HorizontalAlign | None | Unset: 360 if data is None: 361 return data 362 if isinstance(data, Unset): 363 return data 364 try: 365 if not isinstance(data, str): 366 raise TypeError() 367 horizontal_align_type_1 = HorizontalAlign(data) 368 369 return horizontal_align_type_1 370 except (TypeError, ValueError, AttributeError, KeyError): 371 pass 372 return cast(HorizontalAlign | None | Unset, data) 373 374 horizontal_align = _parse_horizontal_align(d.pop("horizontal_align", UNSET)) 375 376 def _parse_vertical_align(data: object) -> None | Unset | VerticalAlign: 377 if data is None: 378 return data 379 if isinstance(data, Unset): 380 return data 381 try: 382 if not isinstance(data, str): 383 raise TypeError() 384 vertical_align_type_1 = VerticalAlign(data) 385 386 return vertical_align_type_1 387 except (TypeError, ValueError, AttributeError, KeyError): 388 pass 389 return cast(None | Unset | VerticalAlign, data) 390 391 vertical_align = _parse_vertical_align(d.pop("vertical_align", UNSET)) 392 393 def _parse_width(data: object) -> float | None | Unset: 394 if data is None: 395 return data 396 if isinstance(data, Unset): 397 return data 398 return cast(float | None | Unset, data) 399 400 width = _parse_width(d.pop("width", UNSET)) 401 402 def _parse_height(data: object) -> float | None | Unset: 403 if data is None: 404 return data 405 if isinstance(data, Unset): 406 return data 407 return cast(float | None | Unset, data) 408 409 height = _parse_height(d.pop("height", UNSET)) 410 411 def _parse_top(data: object) -> float | None | Unset: 412 if data is None: 413 return data 414 if isinstance(data, Unset): 415 return data 416 return cast(float | None | Unset, data) 417 418 top = _parse_top(d.pop("top", UNSET)) 419 420 def _parse_left(data: object) -> float | None | Unset: 421 if data is None: 422 return data 423 if isinstance(data, Unset): 424 return data 425 return cast(float | None | Unset, data) 426 427 left = _parse_left(d.pop("left", UNSET)) 428 429 def _parse_bottom(data: object) -> float | None | Unset: 430 if data is None: 431 return data 432 if isinstance(data, Unset): 433 return data 434 return cast(float | None | Unset, data) 435 436 bottom = _parse_bottom(d.pop("bottom", UNSET)) 437 438 def _parse_right(data: object) -> float | None | Unset: 439 if data is None: 440 return data 441 if isinstance(data, Unset): 442 return data 443 return cast(float | None | Unset, data) 444 445 right = _parse_right(d.pop("right", UNSET)) 446 447 def _parse_rotation(data: object) -> float | None | Unset: 448 if data is None: 449 return data 450 if isinstance(data, Unset): 451 return data 452 return cast(float | None | Unset, data) 453 454 rotation = _parse_rotation(d.pop("rotation", UNSET)) 455 456 def _parse_transition(data: object) -> None | Transition | Unset: 457 if data is None: 458 return data 459 if isinstance(data, Unset): 460 return data 461 try: 462 if not isinstance(data, dict): 463 raise TypeError() 464 transition_type_1 = Transition.from_dict(data) 465 466 return transition_type_1 467 except (TypeError, ValueError, AttributeError, KeyError): 468 pass 469 return cast(None | Transition | Unset, data) 470 471 transition = _parse_transition(d.pop("transition", UNSET)) 472 473 def _parse_border_radius(data: object) -> float | None | Unset: 474 if data is None: 475 return data 476 if isinstance(data, Unset): 477 return data 478 return cast(float | None | Unset, data) 479 480 border_radius = _parse_border_radius(d.pop("border_radius", UNSET)) 481 482 def _parse_border_width(data: object) -> float | None | Unset: 483 if data is None: 484 return data 485 if isinstance(data, Unset): 486 return data 487 return cast(float | None | Unset, data) 488 489 border_width = _parse_border_width(d.pop("border_width", UNSET)) 490 491 def _parse_border_color(data: object) -> None | str | Unset: 492 if data is None: 493 return data 494 if isinstance(data, Unset): 495 return data 496 return cast(None | str | Unset, data) 497 498 border_color = _parse_border_color(d.pop("border_color", UNSET)) 499 500 def _parse_box_shadow(data: object) -> list[BoxShadow] | None | Unset: 501 if data is None: 502 return data 503 if isinstance(data, Unset): 504 return data 505 try: 506 if not isinstance(data, list): 507 raise TypeError() 508 box_shadow_type_0 = [] 509 _box_shadow_type_0 = data 510 for box_shadow_type_0_item_data in _box_shadow_type_0: 511 box_shadow_type_0_item = BoxShadow.from_dict( 512 box_shadow_type_0_item_data 513 ) 514 515 box_shadow_type_0.append(box_shadow_type_0_item) 516 517 return box_shadow_type_0 518 except (TypeError, ValueError, AttributeError, KeyError): 519 pass 520 return cast(list[BoxShadow] | None | Unset, data) 521 522 box_shadow = _parse_box_shadow(d.pop("box_shadow", UNSET)) 523 524 rescaler = cls( 525 child=child, 526 type_=type_, 527 id=id, 528 mode=mode, 529 horizontal_align=horizontal_align, 530 vertical_align=vertical_align, 531 width=width, 532 height=height, 533 top=top, 534 left=left, 535 bottom=bottom, 536 right=right, 537 rotation=rotation, 538 transition=transition, 539 border_radius=border_radius, 540 border_width=border_width, 541 border_color=border_color, 542 box_shadow=box_shadow, 543 ) 544 545 return rescaler
Attributes:
- child (Image | InputStream | Rescaler | Text | Tiles | View):
- type_ (RescalerType):
- id (None | str | Unset):
- mode (None | RescaleMode | Unset):
- horizontal_align (HorizontalAlign | None | Unset):
- vertical_align (None | Unset | VerticalAlign):
- width (float | None | Unset): Width of a component in pixels (without a border). Exact behavior might be
different
based on the parent component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- height (float | None | Unset): Height of a component in pixels (without a border). Exact behavior might be
different
based on the parent component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- top (float | None | Unset): Distance in pixels between this component's top edge and its parent's top edge (including a border). If this field is defined, then the component will ignore a layout defined by its parent.
- left (float | None | Unset): Distance in pixels between this component's left edge and its parent's left edge (including a border). If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- bottom (float | None | Unset): Distance in pixels between the bottom edge of this component and the bottom edge of its parent (including a border). If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- right (float | None | Unset): Distance in pixels between this component's right edge and its parent's right edge. If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- rotation (float | None | Unset): Rotation of a component in degrees. If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- transition (None | Transition | Unset):
- border_radius (float | None | Unset): (default=
0.0) Radius of a rounded corner. - border_width (float | None | Unset): (default=
0.0) Border width. - border_color (None | str | Unset):
- box_shadow (list[BoxShadow] | None | Unset): List of box shadows.
40def __init__(self, child, type_, id=attr_dict['id'].default, mode=attr_dict['mode'].default, horizontal_align=attr_dict['horizontal_align'].default, vertical_align=attr_dict['vertical_align'].default, width=attr_dict['width'].default, height=attr_dict['height'].default, top=attr_dict['top'].default, left=attr_dict['left'].default, bottom=attr_dict['bottom'].default, right=attr_dict['right'].default, rotation=attr_dict['rotation'].default, transition=attr_dict['transition'].default, border_radius=attr_dict['border_radius'].default, border_width=attr_dict['border_width'].default, border_color=attr_dict['border_color'].default, box_shadow=attr_dict['box_shadow'].default): 41 self.child = child 42 self.type_ = type_ 43 self.id = id 44 self.mode = mode 45 self.horizontal_align = horizontal_align 46 self.vertical_align = vertical_align 47 self.width = width 48 self.height = height 49 self.top = top 50 self.left = left 51 self.bottom = bottom 52 self.right = right 53 self.rotation = rotation 54 self.transition = transition 55 self.border_radius = border_radius 56 self.border_width = border_width 57 self.border_color = border_color 58 self.box_shadow = box_shadow
Method generated by attrs for class Rescaler.
94 def to_dict(self) -> dict[str, Any]: 95 from ..models.input_stream import InputStream 96 from ..models.text import Text 97 from ..models.tiles import Tiles 98 from ..models.transition import Transition 99 from ..models.view import View 100 101 child: dict[str, Any] 102 if isinstance(self.child, InputStream): 103 child = self.child.to_dict() 104 elif isinstance(self.child, View): 105 child = self.child.to_dict() 106 elif isinstance(self.child, Text): 107 child = self.child.to_dict() 108 elif isinstance(self.child, Tiles): 109 child = self.child.to_dict() 110 elif isinstance(self.child, Rescaler): 111 child = self.child.to_dict() 112 else: 113 child = self.child.to_dict() 114 115 type_ = self.type_.value 116 117 id: None | str | Unset 118 if isinstance(self.id, Unset): 119 id = UNSET 120 else: 121 id = self.id 122 123 mode: None | str | Unset 124 if isinstance(self.mode, Unset): 125 mode = UNSET 126 elif isinstance(self.mode, RescaleMode): 127 mode = self.mode.value 128 else: 129 mode = self.mode 130 131 horizontal_align: None | str | Unset 132 if isinstance(self.horizontal_align, Unset): 133 horizontal_align = UNSET 134 elif isinstance(self.horizontal_align, HorizontalAlign): 135 horizontal_align = self.horizontal_align.value 136 else: 137 horizontal_align = self.horizontal_align 138 139 vertical_align: None | str | Unset 140 if isinstance(self.vertical_align, Unset): 141 vertical_align = UNSET 142 elif isinstance(self.vertical_align, VerticalAlign): 143 vertical_align = self.vertical_align.value 144 else: 145 vertical_align = self.vertical_align 146 147 width: float | None | Unset 148 if isinstance(self.width, Unset): 149 width = UNSET 150 else: 151 width = self.width 152 153 height: float | None | Unset 154 if isinstance(self.height, Unset): 155 height = UNSET 156 else: 157 height = self.height 158 159 top: float | None | Unset 160 if isinstance(self.top, Unset): 161 top = UNSET 162 else: 163 top = self.top 164 165 left: float | None | Unset 166 if isinstance(self.left, Unset): 167 left = UNSET 168 else: 169 left = self.left 170 171 bottom: float | None | Unset 172 if isinstance(self.bottom, Unset): 173 bottom = UNSET 174 else: 175 bottom = self.bottom 176 177 right: float | None | Unset 178 if isinstance(self.right, Unset): 179 right = UNSET 180 else: 181 right = self.right 182 183 rotation: float | None | Unset 184 if isinstance(self.rotation, Unset): 185 rotation = UNSET 186 else: 187 rotation = self.rotation 188 189 transition: dict[str, Any] | None | Unset 190 if isinstance(self.transition, Unset): 191 transition = UNSET 192 elif isinstance(self.transition, Transition): 193 transition = self.transition.to_dict() 194 else: 195 transition = self.transition 196 197 border_radius: float | None | Unset 198 if isinstance(self.border_radius, Unset): 199 border_radius = UNSET 200 else: 201 border_radius = self.border_radius 202 203 border_width: float | None | Unset 204 if isinstance(self.border_width, Unset): 205 border_width = UNSET 206 else: 207 border_width = self.border_width 208 209 border_color: None | str | Unset 210 if isinstance(self.border_color, Unset): 211 border_color = UNSET 212 else: 213 border_color = self.border_color 214 215 box_shadow: list[dict[str, Any]] | None | Unset 216 if isinstance(self.box_shadow, Unset): 217 box_shadow = UNSET 218 elif isinstance(self.box_shadow, list): 219 box_shadow = [] 220 for box_shadow_type_0_item_data in self.box_shadow: 221 box_shadow_type_0_item = box_shadow_type_0_item_data.to_dict() 222 box_shadow.append(box_shadow_type_0_item) 223 224 else: 225 box_shadow = self.box_shadow 226 227 field_dict: dict[str, Any] = {} 228 229 field_dict.update({ 230 "child": child, 231 "type": type_, 232 }) 233 if id is not UNSET: 234 field_dict["id"] = id 235 if mode is not UNSET: 236 field_dict["mode"] = mode 237 if horizontal_align is not UNSET: 238 field_dict["horizontal_align"] = horizontal_align 239 if vertical_align is not UNSET: 240 field_dict["vertical_align"] = vertical_align 241 if width is not UNSET: 242 field_dict["width"] = width 243 if height is not UNSET: 244 field_dict["height"] = height 245 if top is not UNSET: 246 field_dict["top"] = top 247 if left is not UNSET: 248 field_dict["left"] = left 249 if bottom is not UNSET: 250 field_dict["bottom"] = bottom 251 if right is not UNSET: 252 field_dict["right"] = right 253 if rotation is not UNSET: 254 field_dict["rotation"] = rotation 255 if transition is not UNSET: 256 field_dict["transition"] = transition 257 if border_radius is not UNSET: 258 field_dict["border_radius"] = border_radius 259 if border_width is not UNSET: 260 field_dict["border_width"] = border_width 261 if border_color is not UNSET: 262 field_dict["border_color"] = border_color 263 if box_shadow is not UNSET: 264 field_dict["box_shadow"] = box_shadow 265 266 return field_dict
268 @classmethod 269 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 270 from ..models.box_shadow import BoxShadow 271 from ..models.image import Image 272 from ..models.input_stream import InputStream 273 from ..models.text import Text 274 from ..models.tiles import Tiles 275 from ..models.transition import Transition 276 from ..models.view import View 277 278 d = dict(src_dict) 279 280 def _parse_child( 281 data: object, 282 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 283 try: 284 if not isinstance(data, dict): 285 raise TypeError() 286 componentsschemas_component_type_0 = InputStream.from_dict(data) 287 288 return componentsschemas_component_type_0 289 except (TypeError, ValueError, AttributeError, KeyError): 290 pass 291 try: 292 if not isinstance(data, dict): 293 raise TypeError() 294 componentsschemas_component_type_1 = View.from_dict(data) 295 296 return componentsschemas_component_type_1 297 except (TypeError, ValueError, AttributeError, KeyError): 298 pass 299 try: 300 if not isinstance(data, dict): 301 raise TypeError() 302 componentsschemas_component_type_2 = Text.from_dict(data) 303 304 return componentsschemas_component_type_2 305 except (TypeError, ValueError, AttributeError, KeyError): 306 pass 307 try: 308 if not isinstance(data, dict): 309 raise TypeError() 310 componentsschemas_component_type_3 = Tiles.from_dict(data) 311 312 return componentsschemas_component_type_3 313 except (TypeError, ValueError, AttributeError, KeyError): 314 pass 315 try: 316 if not isinstance(data, dict): 317 raise TypeError() 318 componentsschemas_component_type_4 = Rescaler.from_dict(data) 319 320 return componentsschemas_component_type_4 321 except (TypeError, ValueError, AttributeError, KeyError): 322 pass 323 if not isinstance(data, dict): 324 raise TypeError() 325 componentsschemas_component_type_5 = Image.from_dict(data) 326 327 return componentsschemas_component_type_5 328 329 child = _parse_child(d.pop("child")) 330 331 type_ = RescalerType(d.pop("type")) 332 333 def _parse_id(data: object) -> None | str | Unset: 334 if data is None: 335 return data 336 if isinstance(data, Unset): 337 return data 338 return cast(None | str | Unset, data) 339 340 id = _parse_id(d.pop("id", UNSET)) 341 342 def _parse_mode(data: object) -> None | RescaleMode | Unset: 343 if data is None: 344 return data 345 if isinstance(data, Unset): 346 return data 347 try: 348 if not isinstance(data, str): 349 raise TypeError() 350 mode_type_1 = RescaleMode(data) 351 352 return mode_type_1 353 except (TypeError, ValueError, AttributeError, KeyError): 354 pass 355 return cast(None | RescaleMode | Unset, data) 356 357 mode = _parse_mode(d.pop("mode", UNSET)) 358 359 def _parse_horizontal_align(data: object) -> HorizontalAlign | None | Unset: 360 if data is None: 361 return data 362 if isinstance(data, Unset): 363 return data 364 try: 365 if not isinstance(data, str): 366 raise TypeError() 367 horizontal_align_type_1 = HorizontalAlign(data) 368 369 return horizontal_align_type_1 370 except (TypeError, ValueError, AttributeError, KeyError): 371 pass 372 return cast(HorizontalAlign | None | Unset, data) 373 374 horizontal_align = _parse_horizontal_align(d.pop("horizontal_align", UNSET)) 375 376 def _parse_vertical_align(data: object) -> None | Unset | VerticalAlign: 377 if data is None: 378 return data 379 if isinstance(data, Unset): 380 return data 381 try: 382 if not isinstance(data, str): 383 raise TypeError() 384 vertical_align_type_1 = VerticalAlign(data) 385 386 return vertical_align_type_1 387 except (TypeError, ValueError, AttributeError, KeyError): 388 pass 389 return cast(None | Unset | VerticalAlign, data) 390 391 vertical_align = _parse_vertical_align(d.pop("vertical_align", UNSET)) 392 393 def _parse_width(data: object) -> float | None | Unset: 394 if data is None: 395 return data 396 if isinstance(data, Unset): 397 return data 398 return cast(float | None | Unset, data) 399 400 width = _parse_width(d.pop("width", UNSET)) 401 402 def _parse_height(data: object) -> float | None | Unset: 403 if data is None: 404 return data 405 if isinstance(data, Unset): 406 return data 407 return cast(float | None | Unset, data) 408 409 height = _parse_height(d.pop("height", UNSET)) 410 411 def _parse_top(data: object) -> float | None | Unset: 412 if data is None: 413 return data 414 if isinstance(data, Unset): 415 return data 416 return cast(float | None | Unset, data) 417 418 top = _parse_top(d.pop("top", UNSET)) 419 420 def _parse_left(data: object) -> float | None | Unset: 421 if data is None: 422 return data 423 if isinstance(data, Unset): 424 return data 425 return cast(float | None | Unset, data) 426 427 left = _parse_left(d.pop("left", UNSET)) 428 429 def _parse_bottom(data: object) -> float | None | Unset: 430 if data is None: 431 return data 432 if isinstance(data, Unset): 433 return data 434 return cast(float | None | Unset, data) 435 436 bottom = _parse_bottom(d.pop("bottom", UNSET)) 437 438 def _parse_right(data: object) -> float | None | Unset: 439 if data is None: 440 return data 441 if isinstance(data, Unset): 442 return data 443 return cast(float | None | Unset, data) 444 445 right = _parse_right(d.pop("right", UNSET)) 446 447 def _parse_rotation(data: object) -> float | None | Unset: 448 if data is None: 449 return data 450 if isinstance(data, Unset): 451 return data 452 return cast(float | None | Unset, data) 453 454 rotation = _parse_rotation(d.pop("rotation", UNSET)) 455 456 def _parse_transition(data: object) -> None | Transition | Unset: 457 if data is None: 458 return data 459 if isinstance(data, Unset): 460 return data 461 try: 462 if not isinstance(data, dict): 463 raise TypeError() 464 transition_type_1 = Transition.from_dict(data) 465 466 return transition_type_1 467 except (TypeError, ValueError, AttributeError, KeyError): 468 pass 469 return cast(None | Transition | Unset, data) 470 471 transition = _parse_transition(d.pop("transition", UNSET)) 472 473 def _parse_border_radius(data: object) -> float | None | Unset: 474 if data is None: 475 return data 476 if isinstance(data, Unset): 477 return data 478 return cast(float | None | Unset, data) 479 480 border_radius = _parse_border_radius(d.pop("border_radius", UNSET)) 481 482 def _parse_border_width(data: object) -> float | None | Unset: 483 if data is None: 484 return data 485 if isinstance(data, Unset): 486 return data 487 return cast(float | None | Unset, data) 488 489 border_width = _parse_border_width(d.pop("border_width", UNSET)) 490 491 def _parse_border_color(data: object) -> None | str | Unset: 492 if data is None: 493 return data 494 if isinstance(data, Unset): 495 return data 496 return cast(None | str | Unset, data) 497 498 border_color = _parse_border_color(d.pop("border_color", UNSET)) 499 500 def _parse_box_shadow(data: object) -> list[BoxShadow] | None | Unset: 501 if data is None: 502 return data 503 if isinstance(data, Unset): 504 return data 505 try: 506 if not isinstance(data, list): 507 raise TypeError() 508 box_shadow_type_0 = [] 509 _box_shadow_type_0 = data 510 for box_shadow_type_0_item_data in _box_shadow_type_0: 511 box_shadow_type_0_item = BoxShadow.from_dict( 512 box_shadow_type_0_item_data 513 ) 514 515 box_shadow_type_0.append(box_shadow_type_0_item) 516 517 return box_shadow_type_0 518 except (TypeError, ValueError, AttributeError, KeyError): 519 pass 520 return cast(list[BoxShadow] | None | Unset, data) 521 522 box_shadow = _parse_box_shadow(d.pop("box_shadow", UNSET)) 523 524 rescaler = cls( 525 child=child, 526 type_=type_, 527 id=id, 528 mode=mode, 529 horizontal_align=horizontal_align, 530 vertical_align=vertical_align, 531 width=width, 532 height=height, 533 top=top, 534 left=left, 535 bottom=bottom, 536 right=right, 537 rotation=rotation, 538 transition=transition, 539 border_radius=border_radius, 540 border_width=border_width, 541 border_color=border_color, 542 box_shadow=box_shadow, 543 ) 544 545 return rescaler
5class RescalerType(str, Enum): 6 """None""" 7 8 RESCALER = "rescaler" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
13@_attrs_define 14class Resolution: 15 """ 16 Attributes: 17 width (int): Width in pixels. 18 height (int): Height in pixels. 19 """ 20 21 width: int 22 height: int 23 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 24 25 def to_dict(self) -> dict[str, Any]: 26 width = self.width 27 28 height = self.height 29 30 field_dict: dict[str, Any] = {} 31 field_dict.update(self.additional_properties) 32 field_dict.update({ 33 "width": width, 34 "height": height, 35 }) 36 37 return field_dict 38 39 @classmethod 40 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 41 d = dict(src_dict) 42 width = d.pop("width") 43 44 height = d.pop("height") 45 46 resolution = cls( 47 width=width, 48 height=height, 49 ) 50 51 resolution.additional_properties = d 52 return resolution 53 54 @property 55 def additional_keys(self) -> list[str]: 56 return list(self.additional_properties.keys()) 57 58 def __getitem__(self, key: str) -> Any: 59 return self.additional_properties[key] 60 61 def __setitem__(self, key: str, value: Any) -> None: 62 self.additional_properties[key] = value 63 64 def __delitem__(self, key: str) -> None: 65 del self.additional_properties[key] 66 67 def __contains__(self, key: str) -> bool: 68 return key in self.additional_properties
Attributes:
- width (int): Width in pixels.
- height (int): Height in pixels.
25def __init__(self, width, height): 26 self.width = width 27 self.height = height 28 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class Resolution.
14@_attrs_define 15class RtmpInput: 16 """ 17 Attributes: 18 stream_key (str): The RTMP stream key. 19 This is the path segment of the RTMP stream URL that Smelter listens on for incoming streams. 20 Format: `rtmp://<ip_address>:<port>/<stream_key>` 21 type_ (RtmpInputType): 22 """ 23 24 stream_key: str 25 type_: RtmpInputType 26 27 def to_dict(self) -> dict[str, Any]: 28 stream_key = self.stream_key 29 30 type_ = self.type_.value 31 32 field_dict: dict[str, Any] = {} 33 34 field_dict.update({ 35 "stream_key": stream_key, 36 "type": type_, 37 }) 38 39 return field_dict 40 41 @classmethod 42 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 43 d = dict(src_dict) 44 stream_key = d.pop("stream_key") 45 46 type_ = RtmpInputType(d.pop("type")) 47 48 rtmp_input = cls( 49 stream_key=stream_key, 50 type_=type_, 51 ) 52 53 return rtmp_input
Attributes:
- stream_key (str): The RTMP stream key.
This is the path segment of the RTMP stream URL that Smelter listens on for incoming streams.
Format:
rtmp://<ip_address>:<port>/<stream_key> - type_ (RtmpInputType):
5class RtmpInputType(str, Enum): 6 """None""" 7 8 RTMP_SERVER = "rtmp_server" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
20@_attrs_define 21class RtmpOutput: 22 """ 23 Attributes: 24 url (str): RTMP endpoint url. 25 type_ (RtmpOutputType): 26 video (None | OutputRtmpClientVideoOptions | Unset): 27 audio (None | OutputRtmpClientAudioOptions | Unset): 28 """ 29 30 url: str 31 type_: RtmpOutputType 32 video: None | OutputRtmpClientVideoOptions | Unset = UNSET 33 audio: None | OutputRtmpClientAudioOptions | Unset = UNSET 34 35 def to_dict(self) -> dict[str, Any]: 36 from ..models.output_rtmp_client_audio_options import ( 37 OutputRtmpClientAudioOptions, 38 ) 39 from ..models.output_rtmp_client_video_options import ( 40 OutputRtmpClientVideoOptions, 41 ) 42 43 url = self.url 44 45 type_ = self.type_.value 46 47 video: dict[str, Any] | None | Unset 48 if isinstance(self.video, Unset): 49 video = UNSET 50 elif isinstance(self.video, OutputRtmpClientVideoOptions): 51 video = self.video.to_dict() 52 else: 53 video = self.video 54 55 audio: dict[str, Any] | None | Unset 56 if isinstance(self.audio, Unset): 57 audio = UNSET 58 elif isinstance(self.audio, OutputRtmpClientAudioOptions): 59 audio = self.audio.to_dict() 60 else: 61 audio = self.audio 62 63 field_dict: dict[str, Any] = {} 64 65 field_dict.update({ 66 "url": url, 67 "type": type_, 68 }) 69 if video is not UNSET: 70 field_dict["video"] = video 71 if audio is not UNSET: 72 field_dict["audio"] = audio 73 74 return field_dict 75 76 @classmethod 77 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 78 from ..models.output_rtmp_client_audio_options import ( 79 OutputRtmpClientAudioOptions, 80 ) 81 from ..models.output_rtmp_client_video_options import ( 82 OutputRtmpClientVideoOptions, 83 ) 84 85 d = dict(src_dict) 86 url = d.pop("url") 87 88 type_ = RtmpOutputType(d.pop("type")) 89 90 def _parse_video(data: object) -> None | OutputRtmpClientVideoOptions | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 try: 96 if not isinstance(data, dict): 97 raise TypeError() 98 video_type_1 = OutputRtmpClientVideoOptions.from_dict(data) 99 100 return video_type_1 101 except (TypeError, ValueError, AttributeError, KeyError): 102 pass 103 return cast(None | OutputRtmpClientVideoOptions | Unset, data) 104 105 video = _parse_video(d.pop("video", UNSET)) 106 107 def _parse_audio(data: object) -> None | OutputRtmpClientAudioOptions | Unset: 108 if data is None: 109 return data 110 if isinstance(data, Unset): 111 return data 112 try: 113 if not isinstance(data, dict): 114 raise TypeError() 115 audio_type_1 = OutputRtmpClientAudioOptions.from_dict(data) 116 117 return audio_type_1 118 except (TypeError, ValueError, AttributeError, KeyError): 119 pass 120 return cast(None | OutputRtmpClientAudioOptions | Unset, data) 121 122 audio = _parse_audio(d.pop("audio", UNSET)) 123 124 rtmp_output = cls( 125 url=url, 126 type_=type_, 127 video=video, 128 audio=audio, 129 ) 130 131 return rtmp_output
Attributes:
- url (str): RTMP endpoint url.
- type_ (RtmpOutputType):
- video (None | OutputRtmpClientVideoOptions | Unset):
- audio (None | OutputRtmpClientAudioOptions | Unset):
26def __init__(self, url, type_, video=attr_dict['video'].default, audio=attr_dict['audio'].default): 27 self.url = url 28 self.type_ = type_ 29 self.video = video 30 self.audio = audio
Method generated by attrs for class RtmpOutput.
35 def to_dict(self) -> dict[str, Any]: 36 from ..models.output_rtmp_client_audio_options import ( 37 OutputRtmpClientAudioOptions, 38 ) 39 from ..models.output_rtmp_client_video_options import ( 40 OutputRtmpClientVideoOptions, 41 ) 42 43 url = self.url 44 45 type_ = self.type_.value 46 47 video: dict[str, Any] | None | Unset 48 if isinstance(self.video, Unset): 49 video = UNSET 50 elif isinstance(self.video, OutputRtmpClientVideoOptions): 51 video = self.video.to_dict() 52 else: 53 video = self.video 54 55 audio: dict[str, Any] | None | Unset 56 if isinstance(self.audio, Unset): 57 audio = UNSET 58 elif isinstance(self.audio, OutputRtmpClientAudioOptions): 59 audio = self.audio.to_dict() 60 else: 61 audio = self.audio 62 63 field_dict: dict[str, Any] = {} 64 65 field_dict.update({ 66 "url": url, 67 "type": type_, 68 }) 69 if video is not UNSET: 70 field_dict["video"] = video 71 if audio is not UNSET: 72 field_dict["audio"] = audio 73 74 return field_dict
76 @classmethod 77 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 78 from ..models.output_rtmp_client_audio_options import ( 79 OutputRtmpClientAudioOptions, 80 ) 81 from ..models.output_rtmp_client_video_options import ( 82 OutputRtmpClientVideoOptions, 83 ) 84 85 d = dict(src_dict) 86 url = d.pop("url") 87 88 type_ = RtmpOutputType(d.pop("type")) 89 90 def _parse_video(data: object) -> None | OutputRtmpClientVideoOptions | Unset: 91 if data is None: 92 return data 93 if isinstance(data, Unset): 94 return data 95 try: 96 if not isinstance(data, dict): 97 raise TypeError() 98 video_type_1 = OutputRtmpClientVideoOptions.from_dict(data) 99 100 return video_type_1 101 except (TypeError, ValueError, AttributeError, KeyError): 102 pass 103 return cast(None | OutputRtmpClientVideoOptions | Unset, data) 104 105 video = _parse_video(d.pop("video", UNSET)) 106 107 def _parse_audio(data: object) -> None | OutputRtmpClientAudioOptions | Unset: 108 if data is None: 109 return data 110 if isinstance(data, Unset): 111 return data 112 try: 113 if not isinstance(data, dict): 114 raise TypeError() 115 audio_type_1 = OutputRtmpClientAudioOptions.from_dict(data) 116 117 return audio_type_1 118 except (TypeError, ValueError, AttributeError, KeyError): 119 pass 120 return cast(None | OutputRtmpClientAudioOptions | Unset, data) 121 122 audio = _parse_audio(d.pop("audio", UNSET)) 123 124 rtmp_output = cls( 125 url=url, 126 type_=type_, 127 video=video, 128 audio=audio, 129 ) 130 131 return rtmp_output
5class RtmpOutputType(str, Enum): 6 """None""" 7 8 RTMP_CLIENT = "rtmp_client" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
19@_attrs_define 20class Text: 21 """ 22 Attributes: 23 text (str): Text that will be rendered. 24 font_size (float): Font size in pixels. 25 type_ (TextType): 26 id (None | str | Unset): 27 width (float | None | Unset): Width of a texture that text will be rendered on. If not provided, the resulting 28 texture 29 will be sized based on the defined text but limited to `max_width` value. 30 height (float | None | Unset): Height of a texture that text will be rendered on. If not provided, the resulting 31 texture 32 will be sized based on the defined text but limited to `max_height` value. 33 It's an error to provide `height` if `width` is not defined. 34 max_width (float | None | Unset): (**default=`7682`**) Maximal `width`. Limits the width of the texture that the 35 text will be rendered on. 36 Value is ignored if `width` is defined. 37 max_height (float | None | Unset): (**default=`4320`**) Maximal `height`. Limits the height of the texture that 38 the text will be rendered on. 39 Value is ignored if height is defined. 40 line_height (float | None | Unset): Distance between lines in pixels. Defaults to the value of the `font_size` 41 property. 42 color (None | str | Unset): 43 background_color (None | str | Unset): 44 font_family (None | str | Unset): (**default=`"Verdana"`**) Font family. Provide [family- 45 name](https://www.w3.org/TR/2018/REC-css-fonts-3-20180920/#family-name-value) 46 for a specific font. "generic-family" values like e.g. "sans-serif" will not work. 47 style (None | TextStyle | Unset): 48 align (HorizontalAlign | None | Unset): 49 wrap (None | TextWrapMode | Unset): 50 weight (None | TextWeight | Unset): 51 """ 52 53 text: str 54 font_size: float 55 type_: TextType 56 id: None | str | Unset = UNSET 57 width: float | None | Unset = UNSET 58 height: float | None | Unset = UNSET 59 max_width: float | None | Unset = UNSET 60 max_height: float | None | Unset = UNSET 61 line_height: float | None | Unset = UNSET 62 color: None | str | Unset = UNSET 63 background_color: None | str | Unset = UNSET 64 font_family: None | str | Unset = UNSET 65 style: None | TextStyle | Unset = UNSET 66 align: HorizontalAlign | None | Unset = UNSET 67 wrap: None | TextWrapMode | Unset = UNSET 68 weight: None | TextWeight | Unset = UNSET 69 70 def to_dict(self) -> dict[str, Any]: 71 text = self.text 72 73 font_size = self.font_size 74 75 type_ = self.type_.value 76 77 id: None | str | Unset 78 if isinstance(self.id, Unset): 79 id = UNSET 80 else: 81 id = self.id 82 83 width: float | None | Unset 84 if isinstance(self.width, Unset): 85 width = UNSET 86 else: 87 width = self.width 88 89 height: float | None | Unset 90 if isinstance(self.height, Unset): 91 height = UNSET 92 else: 93 height = self.height 94 95 max_width: float | None | Unset 96 if isinstance(self.max_width, Unset): 97 max_width = UNSET 98 else: 99 max_width = self.max_width 100 101 max_height: float | None | Unset 102 if isinstance(self.max_height, Unset): 103 max_height = UNSET 104 else: 105 max_height = self.max_height 106 107 line_height: float | None | Unset 108 if isinstance(self.line_height, Unset): 109 line_height = UNSET 110 else: 111 line_height = self.line_height 112 113 color: None | str | Unset 114 if isinstance(self.color, Unset): 115 color = UNSET 116 else: 117 color = self.color 118 119 background_color: None | str | Unset 120 if isinstance(self.background_color, Unset): 121 background_color = UNSET 122 else: 123 background_color = self.background_color 124 125 font_family: None | str | Unset 126 if isinstance(self.font_family, Unset): 127 font_family = UNSET 128 else: 129 font_family = self.font_family 130 131 style: None | str | Unset 132 if isinstance(self.style, Unset): 133 style = UNSET 134 elif isinstance(self.style, TextStyle): 135 style = self.style.value 136 else: 137 style = self.style 138 139 align: None | str | Unset 140 if isinstance(self.align, Unset): 141 align = UNSET 142 elif isinstance(self.align, HorizontalAlign): 143 align = self.align.value 144 else: 145 align = self.align 146 147 wrap: None | str | Unset 148 if isinstance(self.wrap, Unset): 149 wrap = UNSET 150 elif isinstance(self.wrap, TextWrapMode): 151 wrap = self.wrap.value 152 else: 153 wrap = self.wrap 154 155 weight: None | str | Unset 156 if isinstance(self.weight, Unset): 157 weight = UNSET 158 elif isinstance(self.weight, TextWeight): 159 weight = self.weight.value 160 else: 161 weight = self.weight 162 163 field_dict: dict[str, Any] = {} 164 165 field_dict.update({ 166 "text": text, 167 "font_size": font_size, 168 "type": type_, 169 }) 170 if id is not UNSET: 171 field_dict["id"] = id 172 if width is not UNSET: 173 field_dict["width"] = width 174 if height is not UNSET: 175 field_dict["height"] = height 176 if max_width is not UNSET: 177 field_dict["max_width"] = max_width 178 if max_height is not UNSET: 179 field_dict["max_height"] = max_height 180 if line_height is not UNSET: 181 field_dict["line_height"] = line_height 182 if color is not UNSET: 183 field_dict["color"] = color 184 if background_color is not UNSET: 185 field_dict["background_color"] = background_color 186 if font_family is not UNSET: 187 field_dict["font_family"] = font_family 188 if style is not UNSET: 189 field_dict["style"] = style 190 if align is not UNSET: 191 field_dict["align"] = align 192 if wrap is not UNSET: 193 field_dict["wrap"] = wrap 194 if weight is not UNSET: 195 field_dict["weight"] = weight 196 197 return field_dict 198 199 @classmethod 200 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 201 d = dict(src_dict) 202 text = d.pop("text") 203 204 font_size = d.pop("font_size") 205 206 type_ = TextType(d.pop("type")) 207 208 def _parse_id(data: object) -> None | str | Unset: 209 if data is None: 210 return data 211 if isinstance(data, Unset): 212 return data 213 return cast(None | str | Unset, data) 214 215 id = _parse_id(d.pop("id", UNSET)) 216 217 def _parse_width(data: object) -> float | None | Unset: 218 if data is None: 219 return data 220 if isinstance(data, Unset): 221 return data 222 return cast(float | None | Unset, data) 223 224 width = _parse_width(d.pop("width", UNSET)) 225 226 def _parse_height(data: object) -> float | None | Unset: 227 if data is None: 228 return data 229 if isinstance(data, Unset): 230 return data 231 return cast(float | None | Unset, data) 232 233 height = _parse_height(d.pop("height", UNSET)) 234 235 def _parse_max_width(data: object) -> float | None | Unset: 236 if data is None: 237 return data 238 if isinstance(data, Unset): 239 return data 240 return cast(float | None | Unset, data) 241 242 max_width = _parse_max_width(d.pop("max_width", UNSET)) 243 244 def _parse_max_height(data: object) -> float | None | Unset: 245 if data is None: 246 return data 247 if isinstance(data, Unset): 248 return data 249 return cast(float | None | Unset, data) 250 251 max_height = _parse_max_height(d.pop("max_height", UNSET)) 252 253 def _parse_line_height(data: object) -> float | None | Unset: 254 if data is None: 255 return data 256 if isinstance(data, Unset): 257 return data 258 return cast(float | None | Unset, data) 259 260 line_height = _parse_line_height(d.pop("line_height", UNSET)) 261 262 def _parse_color(data: object) -> None | str | Unset: 263 if data is None: 264 return data 265 if isinstance(data, Unset): 266 return data 267 return cast(None | str | Unset, data) 268 269 color = _parse_color(d.pop("color", UNSET)) 270 271 def _parse_background_color(data: object) -> None | str | Unset: 272 if data is None: 273 return data 274 if isinstance(data, Unset): 275 return data 276 return cast(None | str | Unset, data) 277 278 background_color = _parse_background_color(d.pop("background_color", UNSET)) 279 280 def _parse_font_family(data: object) -> None | str | Unset: 281 if data is None: 282 return data 283 if isinstance(data, Unset): 284 return data 285 return cast(None | str | Unset, data) 286 287 font_family = _parse_font_family(d.pop("font_family", UNSET)) 288 289 def _parse_style(data: object) -> None | TextStyle | Unset: 290 if data is None: 291 return data 292 if isinstance(data, Unset): 293 return data 294 try: 295 if not isinstance(data, str): 296 raise TypeError() 297 style_type_1 = TextStyle(data) 298 299 return style_type_1 300 except (TypeError, ValueError, AttributeError, KeyError): 301 pass 302 return cast(None | TextStyle | Unset, data) 303 304 style = _parse_style(d.pop("style", UNSET)) 305 306 def _parse_align(data: object) -> HorizontalAlign | None | Unset: 307 if data is None: 308 return data 309 if isinstance(data, Unset): 310 return data 311 try: 312 if not isinstance(data, str): 313 raise TypeError() 314 align_type_1 = HorizontalAlign(data) 315 316 return align_type_1 317 except (TypeError, ValueError, AttributeError, KeyError): 318 pass 319 return cast(HorizontalAlign | None | Unset, data) 320 321 align = _parse_align(d.pop("align", UNSET)) 322 323 def _parse_wrap(data: object) -> None | TextWrapMode | Unset: 324 if data is None: 325 return data 326 if isinstance(data, Unset): 327 return data 328 try: 329 if not isinstance(data, str): 330 raise TypeError() 331 wrap_type_1 = TextWrapMode(data) 332 333 return wrap_type_1 334 except (TypeError, ValueError, AttributeError, KeyError): 335 pass 336 return cast(None | TextWrapMode | Unset, data) 337 338 wrap = _parse_wrap(d.pop("wrap", UNSET)) 339 340 def _parse_weight(data: object) -> None | TextWeight | Unset: 341 if data is None: 342 return data 343 if isinstance(data, Unset): 344 return data 345 try: 346 if not isinstance(data, str): 347 raise TypeError() 348 weight_type_1 = TextWeight(data) 349 350 return weight_type_1 351 except (TypeError, ValueError, AttributeError, KeyError): 352 pass 353 return cast(None | TextWeight | Unset, data) 354 355 weight = _parse_weight(d.pop("weight", UNSET)) 356 357 text = cls( 358 text=text, 359 font_size=font_size, 360 type_=type_, 361 id=id, 362 width=width, 363 height=height, 364 max_width=max_width, 365 max_height=max_height, 366 line_height=line_height, 367 color=color, 368 background_color=background_color, 369 font_family=font_family, 370 style=style, 371 align=align, 372 wrap=wrap, 373 weight=weight, 374 ) 375 376 return text
Attributes:
- text (str): Text that will be rendered.
- font_size (float): Font size in pixels.
- type_ (TextType):
- id (None | str | Unset):
- width (float | None | Unset): Width of a texture that text will be rendered on. If not provided, the resulting
texture
will be sized based on the defined text but limited to
max_widthvalue. - height (float | None | Unset): Height of a texture that text will be rendered on. If not provided, the resulting
texture
will be sized based on the defined text but limited to
max_heightvalue. It's an error to provideheightifwidthis not defined. - max_width (float | None | Unset): (default=
7682) Maximalwidth. Limits the width of the texture that the text will be rendered on. Value is ignored ifwidthis defined. - max_height (float | None | Unset): (default=
4320) Maximalheight. Limits the height of the texture that the text will be rendered on. Value is ignored if height is defined. - line_height (float | None | Unset): Distance between lines in pixels. Defaults to the value of the
font_sizeproperty. - color (None | str | Unset):
- background_color (None | str | Unset):
- font_family (None | str | Unset): (default=
"Verdana") Font family. Provide family- name for a specific font. "generic-family" values like e.g. "sans-serif" will not work. - style (None | TextStyle | Unset):
- align (HorizontalAlign | None | Unset):
- wrap (None | TextWrapMode | Unset):
- weight (None | TextWeight | Unset):
38def __init__(self, text, font_size, type_, id=attr_dict['id'].default, width=attr_dict['width'].default, height=attr_dict['height'].default, max_width=attr_dict['max_width'].default, max_height=attr_dict['max_height'].default, line_height=attr_dict['line_height'].default, color=attr_dict['color'].default, background_color=attr_dict['background_color'].default, font_family=attr_dict['font_family'].default, style=attr_dict['style'].default, align=attr_dict['align'].default, wrap=attr_dict['wrap'].default, weight=attr_dict['weight'].default): 39 self.text = text 40 self.font_size = font_size 41 self.type_ = type_ 42 self.id = id 43 self.width = width 44 self.height = height 45 self.max_width = max_width 46 self.max_height = max_height 47 self.line_height = line_height 48 self.color = color 49 self.background_color = background_color 50 self.font_family = font_family 51 self.style = style 52 self.align = align 53 self.wrap = wrap 54 self.weight = weight
Method generated by attrs for class Text.
70 def to_dict(self) -> dict[str, Any]: 71 text = self.text 72 73 font_size = self.font_size 74 75 type_ = self.type_.value 76 77 id: None | str | Unset 78 if isinstance(self.id, Unset): 79 id = UNSET 80 else: 81 id = self.id 82 83 width: float | None | Unset 84 if isinstance(self.width, Unset): 85 width = UNSET 86 else: 87 width = self.width 88 89 height: float | None | Unset 90 if isinstance(self.height, Unset): 91 height = UNSET 92 else: 93 height = self.height 94 95 max_width: float | None | Unset 96 if isinstance(self.max_width, Unset): 97 max_width = UNSET 98 else: 99 max_width = self.max_width 100 101 max_height: float | None | Unset 102 if isinstance(self.max_height, Unset): 103 max_height = UNSET 104 else: 105 max_height = self.max_height 106 107 line_height: float | None | Unset 108 if isinstance(self.line_height, Unset): 109 line_height = UNSET 110 else: 111 line_height = self.line_height 112 113 color: None | str | Unset 114 if isinstance(self.color, Unset): 115 color = UNSET 116 else: 117 color = self.color 118 119 background_color: None | str | Unset 120 if isinstance(self.background_color, Unset): 121 background_color = UNSET 122 else: 123 background_color = self.background_color 124 125 font_family: None | str | Unset 126 if isinstance(self.font_family, Unset): 127 font_family = UNSET 128 else: 129 font_family = self.font_family 130 131 style: None | str | Unset 132 if isinstance(self.style, Unset): 133 style = UNSET 134 elif isinstance(self.style, TextStyle): 135 style = self.style.value 136 else: 137 style = self.style 138 139 align: None | str | Unset 140 if isinstance(self.align, Unset): 141 align = UNSET 142 elif isinstance(self.align, HorizontalAlign): 143 align = self.align.value 144 else: 145 align = self.align 146 147 wrap: None | str | Unset 148 if isinstance(self.wrap, Unset): 149 wrap = UNSET 150 elif isinstance(self.wrap, TextWrapMode): 151 wrap = self.wrap.value 152 else: 153 wrap = self.wrap 154 155 weight: None | str | Unset 156 if isinstance(self.weight, Unset): 157 weight = UNSET 158 elif isinstance(self.weight, TextWeight): 159 weight = self.weight.value 160 else: 161 weight = self.weight 162 163 field_dict: dict[str, Any] = {} 164 165 field_dict.update({ 166 "text": text, 167 "font_size": font_size, 168 "type": type_, 169 }) 170 if id is not UNSET: 171 field_dict["id"] = id 172 if width is not UNSET: 173 field_dict["width"] = width 174 if height is not UNSET: 175 field_dict["height"] = height 176 if max_width is not UNSET: 177 field_dict["max_width"] = max_width 178 if max_height is not UNSET: 179 field_dict["max_height"] = max_height 180 if line_height is not UNSET: 181 field_dict["line_height"] = line_height 182 if color is not UNSET: 183 field_dict["color"] = color 184 if background_color is not UNSET: 185 field_dict["background_color"] = background_color 186 if font_family is not UNSET: 187 field_dict["font_family"] = font_family 188 if style is not UNSET: 189 field_dict["style"] = style 190 if align is not UNSET: 191 field_dict["align"] = align 192 if wrap is not UNSET: 193 field_dict["wrap"] = wrap 194 if weight is not UNSET: 195 field_dict["weight"] = weight 196 197 return field_dict
199 @classmethod 200 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 201 d = dict(src_dict) 202 text = d.pop("text") 203 204 font_size = d.pop("font_size") 205 206 type_ = TextType(d.pop("type")) 207 208 def _parse_id(data: object) -> None | str | Unset: 209 if data is None: 210 return data 211 if isinstance(data, Unset): 212 return data 213 return cast(None | str | Unset, data) 214 215 id = _parse_id(d.pop("id", UNSET)) 216 217 def _parse_width(data: object) -> float | None | Unset: 218 if data is None: 219 return data 220 if isinstance(data, Unset): 221 return data 222 return cast(float | None | Unset, data) 223 224 width = _parse_width(d.pop("width", UNSET)) 225 226 def _parse_height(data: object) -> float | None | Unset: 227 if data is None: 228 return data 229 if isinstance(data, Unset): 230 return data 231 return cast(float | None | Unset, data) 232 233 height = _parse_height(d.pop("height", UNSET)) 234 235 def _parse_max_width(data: object) -> float | None | Unset: 236 if data is None: 237 return data 238 if isinstance(data, Unset): 239 return data 240 return cast(float | None | Unset, data) 241 242 max_width = _parse_max_width(d.pop("max_width", UNSET)) 243 244 def _parse_max_height(data: object) -> float | None | Unset: 245 if data is None: 246 return data 247 if isinstance(data, Unset): 248 return data 249 return cast(float | None | Unset, data) 250 251 max_height = _parse_max_height(d.pop("max_height", UNSET)) 252 253 def _parse_line_height(data: object) -> float | None | Unset: 254 if data is None: 255 return data 256 if isinstance(data, Unset): 257 return data 258 return cast(float | None | Unset, data) 259 260 line_height = _parse_line_height(d.pop("line_height", UNSET)) 261 262 def _parse_color(data: object) -> None | str | Unset: 263 if data is None: 264 return data 265 if isinstance(data, Unset): 266 return data 267 return cast(None | str | Unset, data) 268 269 color = _parse_color(d.pop("color", UNSET)) 270 271 def _parse_background_color(data: object) -> None | str | Unset: 272 if data is None: 273 return data 274 if isinstance(data, Unset): 275 return data 276 return cast(None | str | Unset, data) 277 278 background_color = _parse_background_color(d.pop("background_color", UNSET)) 279 280 def _parse_font_family(data: object) -> None | str | Unset: 281 if data is None: 282 return data 283 if isinstance(data, Unset): 284 return data 285 return cast(None | str | Unset, data) 286 287 font_family = _parse_font_family(d.pop("font_family", UNSET)) 288 289 def _parse_style(data: object) -> None | TextStyle | Unset: 290 if data is None: 291 return data 292 if isinstance(data, Unset): 293 return data 294 try: 295 if not isinstance(data, str): 296 raise TypeError() 297 style_type_1 = TextStyle(data) 298 299 return style_type_1 300 except (TypeError, ValueError, AttributeError, KeyError): 301 pass 302 return cast(None | TextStyle | Unset, data) 303 304 style = _parse_style(d.pop("style", UNSET)) 305 306 def _parse_align(data: object) -> HorizontalAlign | None | Unset: 307 if data is None: 308 return data 309 if isinstance(data, Unset): 310 return data 311 try: 312 if not isinstance(data, str): 313 raise TypeError() 314 align_type_1 = HorizontalAlign(data) 315 316 return align_type_1 317 except (TypeError, ValueError, AttributeError, KeyError): 318 pass 319 return cast(HorizontalAlign | None | Unset, data) 320 321 align = _parse_align(d.pop("align", UNSET)) 322 323 def _parse_wrap(data: object) -> None | TextWrapMode | Unset: 324 if data is None: 325 return data 326 if isinstance(data, Unset): 327 return data 328 try: 329 if not isinstance(data, str): 330 raise TypeError() 331 wrap_type_1 = TextWrapMode(data) 332 333 return wrap_type_1 334 except (TypeError, ValueError, AttributeError, KeyError): 335 pass 336 return cast(None | TextWrapMode | Unset, data) 337 338 wrap = _parse_wrap(d.pop("wrap", UNSET)) 339 340 def _parse_weight(data: object) -> None | TextWeight | Unset: 341 if data is None: 342 return data 343 if isinstance(data, Unset): 344 return data 345 try: 346 if not isinstance(data, str): 347 raise TypeError() 348 weight_type_1 = TextWeight(data) 349 350 return weight_type_1 351 except (TypeError, ValueError, AttributeError, KeyError): 352 pass 353 return cast(None | TextWeight | Unset, data) 354 355 weight = _parse_weight(d.pop("weight", UNSET)) 356 357 text = cls( 358 text=text, 359 font_size=font_size, 360 type_=type_, 361 id=id, 362 width=width, 363 height=height, 364 max_width=max_width, 365 max_height=max_height, 366 line_height=line_height, 367 color=color, 368 background_color=background_color, 369 font_family=font_family, 370 style=style, 371 align=align, 372 wrap=wrap, 373 weight=weight, 374 ) 375 376 return text
5class TextStyle(str, Enum): 6 """None""" 7 8 ITALIC = "italic" 9 NORMAL = "normal" 10 OBLIQUE = "oblique" 11 12 def __str__(self) -> str: 13 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class TextType(str, Enum): 6 """None""" 7 8 TEXT = "text" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class TextWeight(str, Enum): 6 """Font weight, based on the [OpenType specification](https://learn.microsoft.com/en-gb/typography/opentype/spec/os2#usweightclass).""" 7 8 BLACK = "black" 9 BOLD = "bold" 10 EXTRA_BOLD = "extra_bold" 11 EXTRA_LIGHT = "extra_light" 12 LIGHT = "light" 13 MEDIUM = "medium" 14 NORMAL = "normal" 15 SEMI_BOLD = "semi_bold" 16 THIN = "thin" 17 18 def __str__(self) -> str: 19 return str(self.value)
Font weight, based on the OpenType specification.
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class TextWrapMode(str, Enum): 6 """None""" 7 8 GLYPH = "glyph" 9 NONE = "none" 10 WORD = "word" 11 12 def __str__(self) -> str: 13 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
26@_attrs_define 27class Tiles: 28 """ 29 Attributes: 30 type_ (TilesType): 31 id (None | str | Unset): 32 children (list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset): List of component's 33 children. 34 width (float | None | Unset): Width of a component in pixels. Exact behavior might be different based on the 35 parent 36 component: 37 - If the parent component is a layout, check sections "Absolute positioning" and "Static 38 positioning" of that component. 39 - If the parent component is not a layout, then this field is required. 40 height (float | None | Unset): Height of a component in pixels. Exact behavior might be different based on the 41 parent 42 component: 43 - If the parent component is a layout, check sections "Absolute positioning" and "Static 44 positioning" of that component. 45 - If the parent component is not a layout, then this field is required. 46 background_color (None | str | Unset): 47 tile_aspect_ratio (None | str | Unset): 48 margin (float | None | Unset): (**default=`0`**) Margin of each tile in pixels. 49 padding (float | None | Unset): (**default=`0`**) Padding on each tile in pixels. 50 horizontal_align (HorizontalAlign | None | Unset): 51 vertical_align (None | Unset | VerticalAlign): 52 transition (None | Transition | Unset): 53 """ 54 55 type_: TilesType 56 id: None | str | Unset = UNSET 57 children: ( 58 list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset 59 ) = UNSET 60 width: float | None | Unset = UNSET 61 height: float | None | Unset = UNSET 62 background_color: None | str | Unset = UNSET 63 tile_aspect_ratio: None | str | Unset = UNSET 64 margin: float | None | Unset = UNSET 65 padding: float | None | Unset = UNSET 66 horizontal_align: HorizontalAlign | None | Unset = UNSET 67 vertical_align: None | Unset | VerticalAlign = UNSET 68 transition: None | Transition | Unset = UNSET 69 70 def to_dict(self) -> dict[str, Any]: 71 from ..models.input_stream import InputStream 72 from ..models.rescaler import Rescaler 73 from ..models.text import Text 74 from ..models.transition import Transition 75 from ..models.view import View 76 77 type_ = self.type_.value 78 79 id: None | str | Unset 80 if isinstance(self.id, Unset): 81 id = UNSET 82 else: 83 id = self.id 84 85 children: list[dict[str, Any]] | None | Unset 86 if isinstance(self.children, Unset): 87 children = UNSET 88 elif isinstance(self.children, list): 89 children = [] 90 for children_type_0_item_data in self.children: 91 children_type_0_item: dict[str, Any] 92 if isinstance(children_type_0_item_data, InputStream): 93 children_type_0_item = children_type_0_item_data.to_dict() 94 elif isinstance(children_type_0_item_data, View): 95 children_type_0_item = children_type_0_item_data.to_dict() 96 elif isinstance(children_type_0_item_data, Text): 97 children_type_0_item = children_type_0_item_data.to_dict() 98 elif isinstance(children_type_0_item_data, Tiles): 99 children_type_0_item = children_type_0_item_data.to_dict() 100 elif isinstance(children_type_0_item_data, Rescaler): 101 children_type_0_item = children_type_0_item_data.to_dict() 102 else: 103 children_type_0_item = children_type_0_item_data.to_dict() 104 105 children.append(children_type_0_item) 106 107 else: 108 children = self.children 109 110 width: float | None | Unset 111 if isinstance(self.width, Unset): 112 width = UNSET 113 else: 114 width = self.width 115 116 height: float | None | Unset 117 if isinstance(self.height, Unset): 118 height = UNSET 119 else: 120 height = self.height 121 122 background_color: None | str | Unset 123 if isinstance(self.background_color, Unset): 124 background_color = UNSET 125 else: 126 background_color = self.background_color 127 128 tile_aspect_ratio: None | str | Unset 129 if isinstance(self.tile_aspect_ratio, Unset): 130 tile_aspect_ratio = UNSET 131 else: 132 tile_aspect_ratio = self.tile_aspect_ratio 133 134 margin: float | None | Unset 135 if isinstance(self.margin, Unset): 136 margin = UNSET 137 else: 138 margin = self.margin 139 140 padding: float | None | Unset 141 if isinstance(self.padding, Unset): 142 padding = UNSET 143 else: 144 padding = self.padding 145 146 horizontal_align: None | str | Unset 147 if isinstance(self.horizontal_align, Unset): 148 horizontal_align = UNSET 149 elif isinstance(self.horizontal_align, HorizontalAlign): 150 horizontal_align = self.horizontal_align.value 151 else: 152 horizontal_align = self.horizontal_align 153 154 vertical_align: None | str | Unset 155 if isinstance(self.vertical_align, Unset): 156 vertical_align = UNSET 157 elif isinstance(self.vertical_align, VerticalAlign): 158 vertical_align = self.vertical_align.value 159 else: 160 vertical_align = self.vertical_align 161 162 transition: dict[str, Any] | None | Unset 163 if isinstance(self.transition, Unset): 164 transition = UNSET 165 elif isinstance(self.transition, Transition): 166 transition = self.transition.to_dict() 167 else: 168 transition = self.transition 169 170 field_dict: dict[str, Any] = {} 171 172 field_dict.update({ 173 "type": type_, 174 }) 175 if id is not UNSET: 176 field_dict["id"] = id 177 if children is not UNSET: 178 field_dict["children"] = children 179 if width is not UNSET: 180 field_dict["width"] = width 181 if height is not UNSET: 182 field_dict["height"] = height 183 if background_color is not UNSET: 184 field_dict["background_color"] = background_color 185 if tile_aspect_ratio is not UNSET: 186 field_dict["tile_aspect_ratio"] = tile_aspect_ratio 187 if margin is not UNSET: 188 field_dict["margin"] = margin 189 if padding is not UNSET: 190 field_dict["padding"] = padding 191 if horizontal_align is not UNSET: 192 field_dict["horizontal_align"] = horizontal_align 193 if vertical_align is not UNSET: 194 field_dict["vertical_align"] = vertical_align 195 if transition is not UNSET: 196 field_dict["transition"] = transition 197 198 return field_dict 199 200 @classmethod 201 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 202 from ..models.image import Image 203 from ..models.input_stream import InputStream 204 from ..models.rescaler import Rescaler 205 from ..models.text import Text 206 from ..models.transition import Transition 207 from ..models.view import View 208 209 d = dict(src_dict) 210 type_ = TilesType(d.pop("type")) 211 212 def _parse_id(data: object) -> None | str | Unset: 213 if data is None: 214 return data 215 if isinstance(data, Unset): 216 return data 217 return cast(None | str | Unset, data) 218 219 id = _parse_id(d.pop("id", UNSET)) 220 221 def _parse_children( 222 data: object, 223 ) -> list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset: 224 if data is None: 225 return data 226 if isinstance(data, Unset): 227 return data 228 try: 229 if not isinstance(data, list): 230 raise TypeError() 231 children_type_0 = [] 232 _children_type_0 = data 233 for children_type_0_item_data in _children_type_0: 234 235 def _parse_children_type_0_item( 236 data: object, 237 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 238 try: 239 if not isinstance(data, dict): 240 raise TypeError() 241 componentsschemas_component_type_0 = InputStream.from_dict( 242 data 243 ) 244 245 return componentsschemas_component_type_0 246 except (TypeError, ValueError, AttributeError, KeyError): 247 pass 248 try: 249 if not isinstance(data, dict): 250 raise TypeError() 251 componentsschemas_component_type_1 = View.from_dict(data) 252 253 return componentsschemas_component_type_1 254 except (TypeError, ValueError, AttributeError, KeyError): 255 pass 256 try: 257 if not isinstance(data, dict): 258 raise TypeError() 259 componentsschemas_component_type_2 = Text.from_dict(data) 260 261 return componentsschemas_component_type_2 262 except (TypeError, ValueError, AttributeError, KeyError): 263 pass 264 try: 265 if not isinstance(data, dict): 266 raise TypeError() 267 componentsschemas_component_type_3 = Tiles.from_dict(data) 268 269 return componentsschemas_component_type_3 270 except (TypeError, ValueError, AttributeError, KeyError): 271 pass 272 try: 273 if not isinstance(data, dict): 274 raise TypeError() 275 componentsschemas_component_type_4 = Rescaler.from_dict( 276 data 277 ) 278 279 return componentsschemas_component_type_4 280 except (TypeError, ValueError, AttributeError, KeyError): 281 pass 282 if not isinstance(data, dict): 283 raise TypeError() 284 componentsschemas_component_type_5 = Image.from_dict(data) 285 286 return componentsschemas_component_type_5 287 288 children_type_0_item = _parse_children_type_0_item( 289 children_type_0_item_data 290 ) 291 292 children_type_0.append(children_type_0_item) 293 294 return children_type_0 295 except (TypeError, ValueError, AttributeError, KeyError): 296 pass 297 return cast( 298 list[Image | InputStream | Rescaler | Text | Tiles | View] 299 | None 300 | Unset, 301 data, 302 ) 303 304 children = _parse_children(d.pop("children", UNSET)) 305 306 def _parse_width(data: object) -> float | None | Unset: 307 if data is None: 308 return data 309 if isinstance(data, Unset): 310 return data 311 return cast(float | None | Unset, data) 312 313 width = _parse_width(d.pop("width", UNSET)) 314 315 def _parse_height(data: object) -> float | None | Unset: 316 if data is None: 317 return data 318 if isinstance(data, Unset): 319 return data 320 return cast(float | None | Unset, data) 321 322 height = _parse_height(d.pop("height", UNSET)) 323 324 def _parse_background_color(data: object) -> None | str | Unset: 325 if data is None: 326 return data 327 if isinstance(data, Unset): 328 return data 329 return cast(None | str | Unset, data) 330 331 background_color = _parse_background_color(d.pop("background_color", UNSET)) 332 333 def _parse_tile_aspect_ratio(data: object) -> None | str | Unset: 334 if data is None: 335 return data 336 if isinstance(data, Unset): 337 return data 338 return cast(None | str | Unset, data) 339 340 tile_aspect_ratio = _parse_tile_aspect_ratio(d.pop("tile_aspect_ratio", UNSET)) 341 342 def _parse_margin(data: object) -> float | None | Unset: 343 if data is None: 344 return data 345 if isinstance(data, Unset): 346 return data 347 return cast(float | None | Unset, data) 348 349 margin = _parse_margin(d.pop("margin", UNSET)) 350 351 def _parse_padding(data: object) -> float | None | Unset: 352 if data is None: 353 return data 354 if isinstance(data, Unset): 355 return data 356 return cast(float | None | Unset, data) 357 358 padding = _parse_padding(d.pop("padding", UNSET)) 359 360 def _parse_horizontal_align(data: object) -> HorizontalAlign | None | Unset: 361 if data is None: 362 return data 363 if isinstance(data, Unset): 364 return data 365 try: 366 if not isinstance(data, str): 367 raise TypeError() 368 horizontal_align_type_1 = HorizontalAlign(data) 369 370 return horizontal_align_type_1 371 except (TypeError, ValueError, AttributeError, KeyError): 372 pass 373 return cast(HorizontalAlign | None | Unset, data) 374 375 horizontal_align = _parse_horizontal_align(d.pop("horizontal_align", UNSET)) 376 377 def _parse_vertical_align(data: object) -> None | Unset | VerticalAlign: 378 if data is None: 379 return data 380 if isinstance(data, Unset): 381 return data 382 try: 383 if not isinstance(data, str): 384 raise TypeError() 385 vertical_align_type_1 = VerticalAlign(data) 386 387 return vertical_align_type_1 388 except (TypeError, ValueError, AttributeError, KeyError): 389 pass 390 return cast(None | Unset | VerticalAlign, data) 391 392 vertical_align = _parse_vertical_align(d.pop("vertical_align", UNSET)) 393 394 def _parse_transition(data: object) -> None | Transition | Unset: 395 if data is None: 396 return data 397 if isinstance(data, Unset): 398 return data 399 try: 400 if not isinstance(data, dict): 401 raise TypeError() 402 transition_type_1 = Transition.from_dict(data) 403 404 return transition_type_1 405 except (TypeError, ValueError, AttributeError, KeyError): 406 pass 407 return cast(None | Transition | Unset, data) 408 409 transition = _parse_transition(d.pop("transition", UNSET)) 410 411 tiles = cls( 412 type_=type_, 413 id=id, 414 children=children, 415 width=width, 416 height=height, 417 background_color=background_color, 418 tile_aspect_ratio=tile_aspect_ratio, 419 margin=margin, 420 padding=padding, 421 horizontal_align=horizontal_align, 422 vertical_align=vertical_align, 423 transition=transition, 424 ) 425 426 return tiles
Attributes:
- type_ (TilesType):
- id (None | str | Unset):
- children (list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset): List of component's children.
- width (float | None | Unset): Width of a component in pixels. Exact behavior might be different based on the
parent
component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- height (float | None | Unset): Height of a component in pixels. Exact behavior might be different based on the
parent
component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- background_color (None | str | Unset):
- tile_aspect_ratio (None | str | Unset):
- margin (float | None | Unset): (default=
0) Margin of each tile in pixels. - padding (float | None | Unset): (default=
0) Padding on each tile in pixels. - horizontal_align (HorizontalAlign | None | Unset):
- vertical_align (None | Unset | VerticalAlign):
- transition (None | Transition | Unset):
34def __init__(self, type_, id=attr_dict['id'].default, children=attr_dict['children'].default, width=attr_dict['width'].default, height=attr_dict['height'].default, background_color=attr_dict['background_color'].default, tile_aspect_ratio=attr_dict['tile_aspect_ratio'].default, margin=attr_dict['margin'].default, padding=attr_dict['padding'].default, horizontal_align=attr_dict['horizontal_align'].default, vertical_align=attr_dict['vertical_align'].default, transition=attr_dict['transition'].default): 35 self.type_ = type_ 36 self.id = id 37 self.children = children 38 self.width = width 39 self.height = height 40 self.background_color = background_color 41 self.tile_aspect_ratio = tile_aspect_ratio 42 self.margin = margin 43 self.padding = padding 44 self.horizontal_align = horizontal_align 45 self.vertical_align = vertical_align 46 self.transition = transition
Method generated by attrs for class Tiles.
70 def to_dict(self) -> dict[str, Any]: 71 from ..models.input_stream import InputStream 72 from ..models.rescaler import Rescaler 73 from ..models.text import Text 74 from ..models.transition import Transition 75 from ..models.view import View 76 77 type_ = self.type_.value 78 79 id: None | str | Unset 80 if isinstance(self.id, Unset): 81 id = UNSET 82 else: 83 id = self.id 84 85 children: list[dict[str, Any]] | None | Unset 86 if isinstance(self.children, Unset): 87 children = UNSET 88 elif isinstance(self.children, list): 89 children = [] 90 for children_type_0_item_data in self.children: 91 children_type_0_item: dict[str, Any] 92 if isinstance(children_type_0_item_data, InputStream): 93 children_type_0_item = children_type_0_item_data.to_dict() 94 elif isinstance(children_type_0_item_data, View): 95 children_type_0_item = children_type_0_item_data.to_dict() 96 elif isinstance(children_type_0_item_data, Text): 97 children_type_0_item = children_type_0_item_data.to_dict() 98 elif isinstance(children_type_0_item_data, Tiles): 99 children_type_0_item = children_type_0_item_data.to_dict() 100 elif isinstance(children_type_0_item_data, Rescaler): 101 children_type_0_item = children_type_0_item_data.to_dict() 102 else: 103 children_type_0_item = children_type_0_item_data.to_dict() 104 105 children.append(children_type_0_item) 106 107 else: 108 children = self.children 109 110 width: float | None | Unset 111 if isinstance(self.width, Unset): 112 width = UNSET 113 else: 114 width = self.width 115 116 height: float | None | Unset 117 if isinstance(self.height, Unset): 118 height = UNSET 119 else: 120 height = self.height 121 122 background_color: None | str | Unset 123 if isinstance(self.background_color, Unset): 124 background_color = UNSET 125 else: 126 background_color = self.background_color 127 128 tile_aspect_ratio: None | str | Unset 129 if isinstance(self.tile_aspect_ratio, Unset): 130 tile_aspect_ratio = UNSET 131 else: 132 tile_aspect_ratio = self.tile_aspect_ratio 133 134 margin: float | None | Unset 135 if isinstance(self.margin, Unset): 136 margin = UNSET 137 else: 138 margin = self.margin 139 140 padding: float | None | Unset 141 if isinstance(self.padding, Unset): 142 padding = UNSET 143 else: 144 padding = self.padding 145 146 horizontal_align: None | str | Unset 147 if isinstance(self.horizontal_align, Unset): 148 horizontal_align = UNSET 149 elif isinstance(self.horizontal_align, HorizontalAlign): 150 horizontal_align = self.horizontal_align.value 151 else: 152 horizontal_align = self.horizontal_align 153 154 vertical_align: None | str | Unset 155 if isinstance(self.vertical_align, Unset): 156 vertical_align = UNSET 157 elif isinstance(self.vertical_align, VerticalAlign): 158 vertical_align = self.vertical_align.value 159 else: 160 vertical_align = self.vertical_align 161 162 transition: dict[str, Any] | None | Unset 163 if isinstance(self.transition, Unset): 164 transition = UNSET 165 elif isinstance(self.transition, Transition): 166 transition = self.transition.to_dict() 167 else: 168 transition = self.transition 169 170 field_dict: dict[str, Any] = {} 171 172 field_dict.update({ 173 "type": type_, 174 }) 175 if id is not UNSET: 176 field_dict["id"] = id 177 if children is not UNSET: 178 field_dict["children"] = children 179 if width is not UNSET: 180 field_dict["width"] = width 181 if height is not UNSET: 182 field_dict["height"] = height 183 if background_color is not UNSET: 184 field_dict["background_color"] = background_color 185 if tile_aspect_ratio is not UNSET: 186 field_dict["tile_aspect_ratio"] = tile_aspect_ratio 187 if margin is not UNSET: 188 field_dict["margin"] = margin 189 if padding is not UNSET: 190 field_dict["padding"] = padding 191 if horizontal_align is not UNSET: 192 field_dict["horizontal_align"] = horizontal_align 193 if vertical_align is not UNSET: 194 field_dict["vertical_align"] = vertical_align 195 if transition is not UNSET: 196 field_dict["transition"] = transition 197 198 return field_dict
200 @classmethod 201 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 202 from ..models.image import Image 203 from ..models.input_stream import InputStream 204 from ..models.rescaler import Rescaler 205 from ..models.text import Text 206 from ..models.transition import Transition 207 from ..models.view import View 208 209 d = dict(src_dict) 210 type_ = TilesType(d.pop("type")) 211 212 def _parse_id(data: object) -> None | str | Unset: 213 if data is None: 214 return data 215 if isinstance(data, Unset): 216 return data 217 return cast(None | str | Unset, data) 218 219 id = _parse_id(d.pop("id", UNSET)) 220 221 def _parse_children( 222 data: object, 223 ) -> list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset: 224 if data is None: 225 return data 226 if isinstance(data, Unset): 227 return data 228 try: 229 if not isinstance(data, list): 230 raise TypeError() 231 children_type_0 = [] 232 _children_type_0 = data 233 for children_type_0_item_data in _children_type_0: 234 235 def _parse_children_type_0_item( 236 data: object, 237 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 238 try: 239 if not isinstance(data, dict): 240 raise TypeError() 241 componentsschemas_component_type_0 = InputStream.from_dict( 242 data 243 ) 244 245 return componentsschemas_component_type_0 246 except (TypeError, ValueError, AttributeError, KeyError): 247 pass 248 try: 249 if not isinstance(data, dict): 250 raise TypeError() 251 componentsschemas_component_type_1 = View.from_dict(data) 252 253 return componentsschemas_component_type_1 254 except (TypeError, ValueError, AttributeError, KeyError): 255 pass 256 try: 257 if not isinstance(data, dict): 258 raise TypeError() 259 componentsschemas_component_type_2 = Text.from_dict(data) 260 261 return componentsschemas_component_type_2 262 except (TypeError, ValueError, AttributeError, KeyError): 263 pass 264 try: 265 if not isinstance(data, dict): 266 raise TypeError() 267 componentsschemas_component_type_3 = Tiles.from_dict(data) 268 269 return componentsschemas_component_type_3 270 except (TypeError, ValueError, AttributeError, KeyError): 271 pass 272 try: 273 if not isinstance(data, dict): 274 raise TypeError() 275 componentsschemas_component_type_4 = Rescaler.from_dict( 276 data 277 ) 278 279 return componentsschemas_component_type_4 280 except (TypeError, ValueError, AttributeError, KeyError): 281 pass 282 if not isinstance(data, dict): 283 raise TypeError() 284 componentsschemas_component_type_5 = Image.from_dict(data) 285 286 return componentsschemas_component_type_5 287 288 children_type_0_item = _parse_children_type_0_item( 289 children_type_0_item_data 290 ) 291 292 children_type_0.append(children_type_0_item) 293 294 return children_type_0 295 except (TypeError, ValueError, AttributeError, KeyError): 296 pass 297 return cast( 298 list[Image | InputStream | Rescaler | Text | Tiles | View] 299 | None 300 | Unset, 301 data, 302 ) 303 304 children = _parse_children(d.pop("children", UNSET)) 305 306 def _parse_width(data: object) -> float | None | Unset: 307 if data is None: 308 return data 309 if isinstance(data, Unset): 310 return data 311 return cast(float | None | Unset, data) 312 313 width = _parse_width(d.pop("width", UNSET)) 314 315 def _parse_height(data: object) -> float | None | Unset: 316 if data is None: 317 return data 318 if isinstance(data, Unset): 319 return data 320 return cast(float | None | Unset, data) 321 322 height = _parse_height(d.pop("height", UNSET)) 323 324 def _parse_background_color(data: object) -> None | str | Unset: 325 if data is None: 326 return data 327 if isinstance(data, Unset): 328 return data 329 return cast(None | str | Unset, data) 330 331 background_color = _parse_background_color(d.pop("background_color", UNSET)) 332 333 def _parse_tile_aspect_ratio(data: object) -> None | str | Unset: 334 if data is None: 335 return data 336 if isinstance(data, Unset): 337 return data 338 return cast(None | str | Unset, data) 339 340 tile_aspect_ratio = _parse_tile_aspect_ratio(d.pop("tile_aspect_ratio", UNSET)) 341 342 def _parse_margin(data: object) -> float | None | Unset: 343 if data is None: 344 return data 345 if isinstance(data, Unset): 346 return data 347 return cast(float | None | Unset, data) 348 349 margin = _parse_margin(d.pop("margin", UNSET)) 350 351 def _parse_padding(data: object) -> float | None | Unset: 352 if data is None: 353 return data 354 if isinstance(data, Unset): 355 return data 356 return cast(float | None | Unset, data) 357 358 padding = _parse_padding(d.pop("padding", UNSET)) 359 360 def _parse_horizontal_align(data: object) -> HorizontalAlign | None | Unset: 361 if data is None: 362 return data 363 if isinstance(data, Unset): 364 return data 365 try: 366 if not isinstance(data, str): 367 raise TypeError() 368 horizontal_align_type_1 = HorizontalAlign(data) 369 370 return horizontal_align_type_1 371 except (TypeError, ValueError, AttributeError, KeyError): 372 pass 373 return cast(HorizontalAlign | None | Unset, data) 374 375 horizontal_align = _parse_horizontal_align(d.pop("horizontal_align", UNSET)) 376 377 def _parse_vertical_align(data: object) -> None | Unset | VerticalAlign: 378 if data is None: 379 return data 380 if isinstance(data, Unset): 381 return data 382 try: 383 if not isinstance(data, str): 384 raise TypeError() 385 vertical_align_type_1 = VerticalAlign(data) 386 387 return vertical_align_type_1 388 except (TypeError, ValueError, AttributeError, KeyError): 389 pass 390 return cast(None | Unset | VerticalAlign, data) 391 392 vertical_align = _parse_vertical_align(d.pop("vertical_align", UNSET)) 393 394 def _parse_transition(data: object) -> None | Transition | Unset: 395 if data is None: 396 return data 397 if isinstance(data, Unset): 398 return data 399 try: 400 if not isinstance(data, dict): 401 raise TypeError() 402 transition_type_1 = Transition.from_dict(data) 403 404 return transition_type_1 405 except (TypeError, ValueError, AttributeError, KeyError): 406 pass 407 return cast(None | Transition | Unset, data) 408 409 transition = _parse_transition(d.pop("transition", UNSET)) 410 411 tiles = cls( 412 type_=type_, 413 id=id, 414 children=children, 415 width=width, 416 height=height, 417 background_color=background_color, 418 tile_aspect_ratio=tile_aspect_ratio, 419 margin=margin, 420 padding=padding, 421 horizontal_align=horizontal_align, 422 vertical_align=vertical_align, 423 transition=transition, 424 ) 425 426 return tiles
5class TilesType(str, Enum): 6 """None""" 7 8 TILES = "tiles" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
21@_attrs_define 22class Transition: 23 """ 24 Attributes: 25 duration_ms (float): Duration of a transition in milliseconds. 26 easing_function (EasingFunctionBounce | EasingFunctionCubicBezier | EasingFunctionLinear | None | Unset): 27 should_interrupt (bool | None | Unset): (**default=`false`**) On scene update, if there is already a transition 28 in progress, 29 it will be interrupted and the new transition will start from the current state. 30 """ 31 32 duration_ms: float 33 easing_function: ( 34 EasingFunctionBounce 35 | EasingFunctionCubicBezier 36 | EasingFunctionLinear 37 | None 38 | Unset 39 ) = UNSET 40 should_interrupt: bool | None | Unset = UNSET 41 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 42 43 def to_dict(self) -> dict[str, Any]: 44 from ..models.easing_function_bounce import EasingFunctionBounce 45 from ..models.easing_function_cubic_bezier import EasingFunctionCubicBezier 46 from ..models.easing_function_linear import EasingFunctionLinear 47 48 duration_ms = self.duration_ms 49 50 easing_function: dict[str, Any] | None | Unset 51 if isinstance(self.easing_function, Unset): 52 easing_function = UNSET 53 elif isinstance(self.easing_function, EasingFunctionLinear): 54 easing_function = self.easing_function.to_dict() 55 elif isinstance(self.easing_function, EasingFunctionBounce): 56 easing_function = self.easing_function.to_dict() 57 elif isinstance(self.easing_function, EasingFunctionCubicBezier): 58 easing_function = self.easing_function.to_dict() 59 else: 60 easing_function = self.easing_function 61 62 should_interrupt: bool | None | Unset 63 if isinstance(self.should_interrupt, Unset): 64 should_interrupt = UNSET 65 else: 66 should_interrupt = self.should_interrupt 67 68 field_dict: dict[str, Any] = {} 69 field_dict.update(self.additional_properties) 70 field_dict.update({ 71 "duration_ms": duration_ms, 72 }) 73 if easing_function is not UNSET: 74 field_dict["easing_function"] = easing_function 75 if should_interrupt is not UNSET: 76 field_dict["should_interrupt"] = should_interrupt 77 78 return field_dict 79 80 @classmethod 81 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 82 from ..models.easing_function_bounce import EasingFunctionBounce 83 from ..models.easing_function_cubic_bezier import EasingFunctionCubicBezier 84 from ..models.easing_function_linear import EasingFunctionLinear 85 86 d = dict(src_dict) 87 duration_ms = d.pop("duration_ms") 88 89 def _parse_easing_function( 90 data: object, 91 ) -> ( 92 EasingFunctionBounce 93 | EasingFunctionCubicBezier 94 | EasingFunctionLinear 95 | None 96 | Unset 97 ): 98 if data is None: 99 return data 100 if isinstance(data, Unset): 101 return data 102 try: 103 if not isinstance(data, dict): 104 raise TypeError() 105 componentsschemas_easing_function_easing_function_linear = ( 106 EasingFunctionLinear.from_dict(data) 107 ) 108 109 return componentsschemas_easing_function_easing_function_linear 110 except (TypeError, ValueError, AttributeError, KeyError): 111 pass 112 try: 113 if not isinstance(data, dict): 114 raise TypeError() 115 componentsschemas_easing_function_easing_function_bounce = ( 116 EasingFunctionBounce.from_dict(data) 117 ) 118 119 return componentsschemas_easing_function_easing_function_bounce 120 except (TypeError, ValueError, AttributeError, KeyError): 121 pass 122 try: 123 if not isinstance(data, dict): 124 raise TypeError() 125 componentsschemas_easing_function_easing_function_cubic_bezier = ( 126 EasingFunctionCubicBezier.from_dict(data) 127 ) 128 129 return componentsschemas_easing_function_easing_function_cubic_bezier 130 except (TypeError, ValueError, AttributeError, KeyError): 131 pass 132 return cast( 133 EasingFunctionBounce 134 | EasingFunctionCubicBezier 135 | EasingFunctionLinear 136 | None 137 | Unset, 138 data, 139 ) 140 141 easing_function = _parse_easing_function(d.pop("easing_function", UNSET)) 142 143 def _parse_should_interrupt(data: object) -> bool | None | Unset: 144 if data is None: 145 return data 146 if isinstance(data, Unset): 147 return data 148 return cast(bool | None | Unset, data) 149 150 should_interrupt = _parse_should_interrupt(d.pop("should_interrupt", UNSET)) 151 152 transition = cls( 153 duration_ms=duration_ms, 154 easing_function=easing_function, 155 should_interrupt=should_interrupt, 156 ) 157 158 transition.additional_properties = d 159 return transition 160 161 @property 162 def additional_keys(self) -> list[str]: 163 return list(self.additional_properties.keys()) 164 165 def __getitem__(self, key: str) -> Any: 166 return self.additional_properties[key] 167 168 def __setitem__(self, key: str, value: Any) -> None: 169 self.additional_properties[key] = value 170 171 def __delitem__(self, key: str) -> None: 172 del self.additional_properties[key] 173 174 def __contains__(self, key: str) -> bool: 175 return key in self.additional_properties
Attributes:
- duration_ms (float): Duration of a transition in milliseconds.
- easing_function (EasingFunctionBounce | EasingFunctionCubicBezier | EasingFunctionLinear | None | Unset):
- should_interrupt (bool | None | Unset): (default=
false) On scene update, if there is already a transition in progress, it will be interrupted and the new transition will start from the current state.
26def __init__(self, duration_ms, easing_function=attr_dict['easing_function'].default, should_interrupt=attr_dict['should_interrupt'].default): 27 self.duration_ms = duration_ms 28 self.easing_function = easing_function 29 self.should_interrupt = should_interrupt 30 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class Transition.
43 def to_dict(self) -> dict[str, Any]: 44 from ..models.easing_function_bounce import EasingFunctionBounce 45 from ..models.easing_function_cubic_bezier import EasingFunctionCubicBezier 46 from ..models.easing_function_linear import EasingFunctionLinear 47 48 duration_ms = self.duration_ms 49 50 easing_function: dict[str, Any] | None | Unset 51 if isinstance(self.easing_function, Unset): 52 easing_function = UNSET 53 elif isinstance(self.easing_function, EasingFunctionLinear): 54 easing_function = self.easing_function.to_dict() 55 elif isinstance(self.easing_function, EasingFunctionBounce): 56 easing_function = self.easing_function.to_dict() 57 elif isinstance(self.easing_function, EasingFunctionCubicBezier): 58 easing_function = self.easing_function.to_dict() 59 else: 60 easing_function = self.easing_function 61 62 should_interrupt: bool | None | Unset 63 if isinstance(self.should_interrupt, Unset): 64 should_interrupt = UNSET 65 else: 66 should_interrupt = self.should_interrupt 67 68 field_dict: dict[str, Any] = {} 69 field_dict.update(self.additional_properties) 70 field_dict.update({ 71 "duration_ms": duration_ms, 72 }) 73 if easing_function is not UNSET: 74 field_dict["easing_function"] = easing_function 75 if should_interrupt is not UNSET: 76 field_dict["should_interrupt"] = should_interrupt 77 78 return field_dict
80 @classmethod 81 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 82 from ..models.easing_function_bounce import EasingFunctionBounce 83 from ..models.easing_function_cubic_bezier import EasingFunctionCubicBezier 84 from ..models.easing_function_linear import EasingFunctionLinear 85 86 d = dict(src_dict) 87 duration_ms = d.pop("duration_ms") 88 89 def _parse_easing_function( 90 data: object, 91 ) -> ( 92 EasingFunctionBounce 93 | EasingFunctionCubicBezier 94 | EasingFunctionLinear 95 | None 96 | Unset 97 ): 98 if data is None: 99 return data 100 if isinstance(data, Unset): 101 return data 102 try: 103 if not isinstance(data, dict): 104 raise TypeError() 105 componentsschemas_easing_function_easing_function_linear = ( 106 EasingFunctionLinear.from_dict(data) 107 ) 108 109 return componentsschemas_easing_function_easing_function_linear 110 except (TypeError, ValueError, AttributeError, KeyError): 111 pass 112 try: 113 if not isinstance(data, dict): 114 raise TypeError() 115 componentsschemas_easing_function_easing_function_bounce = ( 116 EasingFunctionBounce.from_dict(data) 117 ) 118 119 return componentsschemas_easing_function_easing_function_bounce 120 except (TypeError, ValueError, AttributeError, KeyError): 121 pass 122 try: 123 if not isinstance(data, dict): 124 raise TypeError() 125 componentsschemas_easing_function_easing_function_cubic_bezier = ( 126 EasingFunctionCubicBezier.from_dict(data) 127 ) 128 129 return componentsschemas_easing_function_easing_function_cubic_bezier 130 except (TypeError, ValueError, AttributeError, KeyError): 131 pass 132 return cast( 133 EasingFunctionBounce 134 | EasingFunctionCubicBezier 135 | EasingFunctionLinear 136 | None 137 | Unset, 138 data, 139 ) 140 141 easing_function = _parse_easing_function(d.pop("easing_function", UNSET)) 142 143 def _parse_should_interrupt(data: object) -> bool | None | Unset: 144 if data is None: 145 return data 146 if isinstance(data, Unset): 147 return data 148 return cast(bool | None | Unset, data) 149 150 should_interrupt = _parse_should_interrupt(d.pop("should_interrupt", UNSET)) 151 152 transition = cls( 153 duration_ms=duration_ms, 154 easing_function=easing_function, 155 should_interrupt=should_interrupt, 156 ) 157 158 transition.additional_properties = d 159 return transition
5class TransportProtocol(str, Enum): 6 """None""" 7 8 TCP_SERVER = "tcp_server" 9 UDP = "udp" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class UnregisterInput: 17 """ 18 Attributes: 19 schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value `0` 20 represents 21 time of the start request. 22 """ 23 24 schedule_time_ms: float | None | Unset = UNSET 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict 41 42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_input = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_input.additional_properties = d 60 return unregister_input 61 62 @property 63 def additional_keys(self) -> list[str]: 64 return list(self.additional_properties.keys()) 65 66 def __getitem__(self, key: str) -> Any: 67 return self.additional_properties[key] 68 69 def __setitem__(self, key: str, value: Any) -> None: 70 self.additional_properties[key] = value 71 72 def __delitem__(self, key: str) -> None: 73 del self.additional_properties[key] 74 75 def __contains__(self, key: str) -> bool: 76 return key in self.additional_properties
Attributes:
- schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value
0represents time of the start request.
24def __init__(self, schedule_time_ms=attr_dict['schedule_time_ms'].default): 25 self.schedule_time_ms = schedule_time_ms 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class UnregisterInput.
27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict
42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_input = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_input.additional_properties = d 60 return unregister_input
15@_attrs_define 16class UnregisterOutput: 17 """ 18 Attributes: 19 schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value `0` 20 represents 21 time of the start request. 22 """ 23 24 schedule_time_ms: float | None | Unset = UNSET 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict 41 42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_output = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_output.additional_properties = d 60 return unregister_output 61 62 @property 63 def additional_keys(self) -> list[str]: 64 return list(self.additional_properties.keys()) 65 66 def __getitem__(self, key: str) -> Any: 67 return self.additional_properties[key] 68 69 def __setitem__(self, key: str, value: Any) -> None: 70 self.additional_properties[key] = value 71 72 def __delitem__(self, key: str) -> None: 73 del self.additional_properties[key] 74 75 def __contains__(self, key: str) -> bool: 76 return key in self.additional_properties
Attributes:
- schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value
0represents time of the start request.
24def __init__(self, schedule_time_ms=attr_dict['schedule_time_ms'].default): 25 self.schedule_time_ms = schedule_time_ms 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class UnregisterOutput.
27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict
42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_output = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_output.additional_properties = d 60 return unregister_output
15@_attrs_define 16class UnregisterRenderer: 17 """ 18 Attributes: 19 schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value `0` 20 represents 21 time of the start request. 22 """ 23 24 schedule_time_ms: float | None | Unset = UNSET 25 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 26 27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict 41 42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_renderer = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_renderer.additional_properties = d 60 return unregister_renderer 61 62 @property 63 def additional_keys(self) -> list[str]: 64 return list(self.additional_properties.keys()) 65 66 def __getitem__(self, key: str) -> Any: 67 return self.additional_properties[key] 68 69 def __setitem__(self, key: str, value: Any) -> None: 70 self.additional_properties[key] = value 71 72 def __delitem__(self, key: str) -> None: 73 del self.additional_properties[key] 74 75 def __contains__(self, key: str) -> bool: 76 return key in self.additional_properties
Attributes:
- schedule_time_ms (float | None | Unset): Time in milliseconds when this request should be applied. Value
0represents time of the start request.
24def __init__(self, schedule_time_ms=attr_dict['schedule_time_ms'].default): 25 self.schedule_time_ms = schedule_time_ms 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class UnregisterRenderer.
27 def to_dict(self) -> dict[str, Any]: 28 schedule_time_ms: float | None | Unset 29 if isinstance(self.schedule_time_ms, Unset): 30 schedule_time_ms = UNSET 31 else: 32 schedule_time_ms = self.schedule_time_ms 33 34 field_dict: dict[str, Any] = {} 35 field_dict.update(self.additional_properties) 36 field_dict.update({}) 37 if schedule_time_ms is not UNSET: 38 field_dict["schedule_time_ms"] = schedule_time_ms 39 40 return field_dict
42 @classmethod 43 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 44 d = dict(src_dict) 45 46 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 47 if data is None: 48 return data 49 if isinstance(data, Unset): 50 return data 51 return cast(float | None | Unset, data) 52 53 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 54 55 unregister_renderer = cls( 56 schedule_time_ms=schedule_time_ms, 57 ) 58 59 unregister_renderer.additional_properties = d 60 return unregister_renderer
19@_attrs_define 20class UpdateOutputRequest: 21 """ 22 Attributes: 23 video (None | Unset | VideoScene): 24 audio (AudioScene | None | Unset): 25 schedule_time_ms (float | None | Unset): 26 """ 27 28 video: None | Unset | VideoScene = UNSET 29 audio: AudioScene | None | Unset = UNSET 30 schedule_time_ms: float | None | Unset = UNSET 31 32 def to_dict(self) -> dict[str, Any]: 33 from ..models.audio_scene import AudioScene 34 from ..models.video_scene import VideoScene 35 36 video: dict[str, Any] | None | Unset 37 if isinstance(self.video, Unset): 38 video = UNSET 39 elif isinstance(self.video, VideoScene): 40 video = self.video.to_dict() 41 else: 42 video = self.video 43 44 audio: dict[str, Any] | None | Unset 45 if isinstance(self.audio, Unset): 46 audio = UNSET 47 elif isinstance(self.audio, AudioScene): 48 audio = self.audio.to_dict() 49 else: 50 audio = self.audio 51 52 schedule_time_ms: float | None | Unset 53 if isinstance(self.schedule_time_ms, Unset): 54 schedule_time_ms = UNSET 55 else: 56 schedule_time_ms = self.schedule_time_ms 57 58 field_dict: dict[str, Any] = {} 59 60 field_dict.update({}) 61 if video is not UNSET: 62 field_dict["video"] = video 63 if audio is not UNSET: 64 field_dict["audio"] = audio 65 if schedule_time_ms is not UNSET: 66 field_dict["schedule_time_ms"] = schedule_time_ms 67 68 return field_dict 69 70 @classmethod 71 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 72 from ..models.audio_scene import AudioScene 73 from ..models.video_scene import VideoScene 74 75 d = dict(src_dict) 76 77 def _parse_video(data: object) -> None | Unset | VideoScene: 78 if data is None: 79 return data 80 if isinstance(data, Unset): 81 return data 82 try: 83 if not isinstance(data, dict): 84 raise TypeError() 85 video_type_1 = VideoScene.from_dict(data) 86 87 return video_type_1 88 except (TypeError, ValueError, AttributeError, KeyError): 89 pass 90 return cast(None | Unset | VideoScene, data) 91 92 video = _parse_video(d.pop("video", UNSET)) 93 94 def _parse_audio(data: object) -> AudioScene | None | Unset: 95 if data is None: 96 return data 97 if isinstance(data, Unset): 98 return data 99 try: 100 if not isinstance(data, dict): 101 raise TypeError() 102 audio_type_1 = AudioScene.from_dict(data) 103 104 return audio_type_1 105 except (TypeError, ValueError, AttributeError, KeyError): 106 pass 107 return cast(AudioScene | None | Unset, data) 108 109 audio = _parse_audio(d.pop("audio", UNSET)) 110 111 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 112 if data is None: 113 return data 114 if isinstance(data, Unset): 115 return data 116 return cast(float | None | Unset, data) 117 118 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 119 120 update_output_request = cls( 121 video=video, 122 audio=audio, 123 schedule_time_ms=schedule_time_ms, 124 ) 125 126 return update_output_request
Attributes:
- video (None | Unset | VideoScene):
- audio (AudioScene | None | Unset):
- schedule_time_ms (float | None | Unset):
25def __init__(self, video=attr_dict['video'].default, audio=attr_dict['audio'].default, schedule_time_ms=attr_dict['schedule_time_ms'].default): 26 self.video = video 27 self.audio = audio 28 self.schedule_time_ms = schedule_time_ms
Method generated by attrs for class UpdateOutputRequest.
32 def to_dict(self) -> dict[str, Any]: 33 from ..models.audio_scene import AudioScene 34 from ..models.video_scene import VideoScene 35 36 video: dict[str, Any] | None | Unset 37 if isinstance(self.video, Unset): 38 video = UNSET 39 elif isinstance(self.video, VideoScene): 40 video = self.video.to_dict() 41 else: 42 video = self.video 43 44 audio: dict[str, Any] | None | Unset 45 if isinstance(self.audio, Unset): 46 audio = UNSET 47 elif isinstance(self.audio, AudioScene): 48 audio = self.audio.to_dict() 49 else: 50 audio = self.audio 51 52 schedule_time_ms: float | None | Unset 53 if isinstance(self.schedule_time_ms, Unset): 54 schedule_time_ms = UNSET 55 else: 56 schedule_time_ms = self.schedule_time_ms 57 58 field_dict: dict[str, Any] = {} 59 60 field_dict.update({}) 61 if video is not UNSET: 62 field_dict["video"] = video 63 if audio is not UNSET: 64 field_dict["audio"] = audio 65 if schedule_time_ms is not UNSET: 66 field_dict["schedule_time_ms"] = schedule_time_ms 67 68 return field_dict
70 @classmethod 71 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 72 from ..models.audio_scene import AudioScene 73 from ..models.video_scene import VideoScene 74 75 d = dict(src_dict) 76 77 def _parse_video(data: object) -> None | Unset | VideoScene: 78 if data is None: 79 return data 80 if isinstance(data, Unset): 81 return data 82 try: 83 if not isinstance(data, dict): 84 raise TypeError() 85 video_type_1 = VideoScene.from_dict(data) 86 87 return video_type_1 88 except (TypeError, ValueError, AttributeError, KeyError): 89 pass 90 return cast(None | Unset | VideoScene, data) 91 92 video = _parse_video(d.pop("video", UNSET)) 93 94 def _parse_audio(data: object) -> AudioScene | None | Unset: 95 if data is None: 96 return data 97 if isinstance(data, Unset): 98 return data 99 try: 100 if not isinstance(data, dict): 101 raise TypeError() 102 audio_type_1 = AudioScene.from_dict(data) 103 104 return audio_type_1 105 except (TypeError, ValueError, AttributeError, KeyError): 106 pass 107 return cast(AudioScene | None | Unset, data) 108 109 audio = _parse_audio(d.pop("audio", UNSET)) 110 111 def _parse_schedule_time_ms(data: object) -> float | None | Unset: 112 if data is None: 113 return data 114 if isinstance(data, Unset): 115 return data 116 return cast(float | None | Unset, data) 117 118 schedule_time_ms = _parse_schedule_time_ms(d.pop("schedule_time_ms", UNSET)) 119 120 update_output_request = cls( 121 video=video, 122 audio=audio, 123 schedule_time_ms=schedule_time_ms, 124 ) 125 126 return update_output_request
5class VerticalAlign(str, Enum): 6 """None""" 7 8 BOTTOM = "bottom" 9 CENTER = "center" 10 JUSTIFIED = "justified" 11 TOP = "top" 12 13 def __str__(self) -> str: 14 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
21@_attrs_define 22class VideoScene: 23 """ 24 Attributes: 25 root (Image | InputStream | Rescaler | Text | Tiles | View): 26 """ 27 28 root: Image | InputStream | Rescaler | Text | Tiles | View 29 30 def to_dict(self) -> dict[str, Any]: 31 from ..models.input_stream import InputStream 32 from ..models.rescaler import Rescaler 33 from ..models.text import Text 34 from ..models.tiles import Tiles 35 from ..models.view import View 36 37 root: dict[str, Any] 38 if isinstance(self.root, InputStream): 39 root = self.root.to_dict() 40 elif isinstance(self.root, View): 41 root = self.root.to_dict() 42 elif isinstance(self.root, Text): 43 root = self.root.to_dict() 44 elif isinstance(self.root, Tiles): 45 root = self.root.to_dict() 46 elif isinstance(self.root, Rescaler): 47 root = self.root.to_dict() 48 else: 49 root = self.root.to_dict() 50 51 field_dict: dict[str, Any] = {} 52 53 field_dict.update({ 54 "root": root, 55 }) 56 57 return field_dict 58 59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.image import Image 62 from ..models.input_stream import InputStream 63 from ..models.rescaler import Rescaler 64 from ..models.text import Text 65 from ..models.tiles import Tiles 66 from ..models.view import View 67 68 d = dict(src_dict) 69 70 def _parse_root( 71 data: object, 72 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 73 try: 74 if not isinstance(data, dict): 75 raise TypeError() 76 componentsschemas_component_type_0 = InputStream.from_dict(data) 77 78 return componentsschemas_component_type_0 79 except (TypeError, ValueError, AttributeError, KeyError): 80 pass 81 try: 82 if not isinstance(data, dict): 83 raise TypeError() 84 componentsschemas_component_type_1 = View.from_dict(data) 85 86 return componentsschemas_component_type_1 87 except (TypeError, ValueError, AttributeError, KeyError): 88 pass 89 try: 90 if not isinstance(data, dict): 91 raise TypeError() 92 componentsschemas_component_type_2 = Text.from_dict(data) 93 94 return componentsschemas_component_type_2 95 except (TypeError, ValueError, AttributeError, KeyError): 96 pass 97 try: 98 if not isinstance(data, dict): 99 raise TypeError() 100 componentsschemas_component_type_3 = Tiles.from_dict(data) 101 102 return componentsschemas_component_type_3 103 except (TypeError, ValueError, AttributeError, KeyError): 104 pass 105 try: 106 if not isinstance(data, dict): 107 raise TypeError() 108 componentsschemas_component_type_4 = Rescaler.from_dict(data) 109 110 return componentsschemas_component_type_4 111 except (TypeError, ValueError, AttributeError, KeyError): 112 pass 113 if not isinstance(data, dict): 114 raise TypeError() 115 componentsschemas_component_type_5 = Image.from_dict(data) 116 117 return componentsschemas_component_type_5 118 119 root = _parse_root(d.pop("root")) 120 121 video_scene = cls( 122 root=root, 123 ) 124 125 return video_scene
Attributes:
- root (Image | InputStream | Rescaler | Text | Tiles | View):
30 def to_dict(self) -> dict[str, Any]: 31 from ..models.input_stream import InputStream 32 from ..models.rescaler import Rescaler 33 from ..models.text import Text 34 from ..models.tiles import Tiles 35 from ..models.view import View 36 37 root: dict[str, Any] 38 if isinstance(self.root, InputStream): 39 root = self.root.to_dict() 40 elif isinstance(self.root, View): 41 root = self.root.to_dict() 42 elif isinstance(self.root, Text): 43 root = self.root.to_dict() 44 elif isinstance(self.root, Tiles): 45 root = self.root.to_dict() 46 elif isinstance(self.root, Rescaler): 47 root = self.root.to_dict() 48 else: 49 root = self.root.to_dict() 50 51 field_dict: dict[str, Any] = {} 52 53 field_dict.update({ 54 "root": root, 55 }) 56 57 return field_dict
59 @classmethod 60 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 61 from ..models.image import Image 62 from ..models.input_stream import InputStream 63 from ..models.rescaler import Rescaler 64 from ..models.text import Text 65 from ..models.tiles import Tiles 66 from ..models.view import View 67 68 d = dict(src_dict) 69 70 def _parse_root( 71 data: object, 72 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 73 try: 74 if not isinstance(data, dict): 75 raise TypeError() 76 componentsschemas_component_type_0 = InputStream.from_dict(data) 77 78 return componentsschemas_component_type_0 79 except (TypeError, ValueError, AttributeError, KeyError): 80 pass 81 try: 82 if not isinstance(data, dict): 83 raise TypeError() 84 componentsschemas_component_type_1 = View.from_dict(data) 85 86 return componentsschemas_component_type_1 87 except (TypeError, ValueError, AttributeError, KeyError): 88 pass 89 try: 90 if not isinstance(data, dict): 91 raise TypeError() 92 componentsschemas_component_type_2 = Text.from_dict(data) 93 94 return componentsschemas_component_type_2 95 except (TypeError, ValueError, AttributeError, KeyError): 96 pass 97 try: 98 if not isinstance(data, dict): 99 raise TypeError() 100 componentsschemas_component_type_3 = Tiles.from_dict(data) 101 102 return componentsschemas_component_type_3 103 except (TypeError, ValueError, AttributeError, KeyError): 104 pass 105 try: 106 if not isinstance(data, dict): 107 raise TypeError() 108 componentsschemas_component_type_4 = Rescaler.from_dict(data) 109 110 return componentsschemas_component_type_4 111 except (TypeError, ValueError, AttributeError, KeyError): 112 pass 113 if not isinstance(data, dict): 114 raise TypeError() 115 componentsschemas_component_type_5 = Image.from_dict(data) 116 117 return componentsschemas_component_type_5 118 119 root = _parse_root(d.pop("root")) 120 121 video_scene = cls( 122 root=root, 123 ) 124 125 return video_scene
27@_attrs_define 28class View: 29 """ 30 Attributes: 31 type_ (ViewType): 32 id (None | str | Unset): 33 children (list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset): List of component's 34 children. 35 width (float | None | Unset): Width of a component in pixels (without a border). Exact behavior might be 36 different 37 based on the parent component: 38 - If the parent component is a layout, check sections "Absolute positioning" and "Static 39 positioning" of that component. 40 - If the parent component is not a layout, then this field is required. 41 height (float | None | Unset): Height of a component in pixels (without a border). Exact behavior might be 42 different 43 based on the parent component: 44 - If the parent component is a layout, check sections "Absolute positioning" and "Static 45 positioning" of that component. 46 - If the parent component is not a layout, then this field is required. 47 direction (None | Unset | ViewDirection): 48 top (float | None | Unset): Distance in pixels between this component's top edge and its parent's top edge 49 (including a border). 50 If this field is defined, then the component will ignore a layout defined by its parent. 51 left (float | None | Unset): Distance in pixels between this component's left edge and its parent's left edge 52 (including a border). 53 If this field is defined, this element will be absolutely positioned, instead of being 54 laid out by its parent. 55 bottom (float | None | Unset): Distance in pixels between the bottom edge of this component and the bottom edge 56 of its 57 parent (including a border). If this field is defined, this element will be absolutely 58 positioned, instead of being laid out by its parent. 59 right (float | None | Unset): Distance in pixels between this component's right edge and its parent's right 60 edge. 61 If this field is defined, this element will be absolutely positioned, instead of being 62 laid out by its parent. 63 rotation (float | None | Unset): Rotation of a component in degrees. If this field is defined, this element will 64 be 65 absolutely positioned, instead of being laid out by its parent. 66 transition (None | Transition | Unset): 67 overflow (None | Overflow | Unset): 68 background_color (None | str | Unset): 69 border_radius (float | None | Unset): (**default=`0.0`**) Radius of a rounded corner. 70 border_width (float | None | Unset): (**default=`0.0`**) Border width. 71 border_color (None | str | Unset): 72 box_shadow (list[BoxShadow] | None | Unset): List of box shadows. 73 padding (float | None | Unset): (**default=`0.0`**) Padding for all sides of the component. 74 padding_vertical (float | None | Unset): (**default=`0.0`**) Padding for the top and bottom of the component. 75 padding_horizontal (float | None | Unset): (**default=`0.0`**) Padding for the left and right of the component. 76 padding_top (float | None | Unset): (**default=`0.0`**) Padding on top side in pixels. 77 padding_right (float | None | Unset): (**default=`0.0`**) Padding on right side in pixels. 78 padding_bottom (float | None | Unset): (**default=`0.0`**) Padding on bottom side in pixels. 79 padding_left (float | None | Unset): (**default=`0.0`**) Padding on left side in pixels. 80 """ 81 82 type_: ViewType 83 id: None | str | Unset = UNSET 84 children: ( 85 list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset 86 ) = UNSET 87 width: float | None | Unset = UNSET 88 height: float | None | Unset = UNSET 89 direction: None | Unset | ViewDirection = UNSET 90 top: float | None | Unset = UNSET 91 left: float | None | Unset = UNSET 92 bottom: float | None | Unset = UNSET 93 right: float | None | Unset = UNSET 94 rotation: float | None | Unset = UNSET 95 transition: None | Transition | Unset = UNSET 96 overflow: None | Overflow | Unset = UNSET 97 background_color: None | str | Unset = UNSET 98 border_radius: float | None | Unset = UNSET 99 border_width: float | None | Unset = UNSET 100 border_color: None | str | Unset = UNSET 101 box_shadow: list[BoxShadow] | None | Unset = UNSET 102 padding: float | None | Unset = UNSET 103 padding_vertical: float | None | Unset = UNSET 104 padding_horizontal: float | None | Unset = UNSET 105 padding_top: float | None | Unset = UNSET 106 padding_right: float | None | Unset = UNSET 107 padding_bottom: float | None | Unset = UNSET 108 padding_left: float | None | Unset = UNSET 109 110 def to_dict(self) -> dict[str, Any]: 111 from ..models.input_stream import InputStream 112 from ..models.rescaler import Rescaler 113 from ..models.text import Text 114 from ..models.tiles import Tiles 115 from ..models.transition import Transition 116 117 type_ = self.type_.value 118 119 id: None | str | Unset 120 if isinstance(self.id, Unset): 121 id = UNSET 122 else: 123 id = self.id 124 125 children: list[dict[str, Any]] | None | Unset 126 if isinstance(self.children, Unset): 127 children = UNSET 128 elif isinstance(self.children, list): 129 children = [] 130 for children_type_0_item_data in self.children: 131 children_type_0_item: dict[str, Any] 132 if isinstance(children_type_0_item_data, InputStream): 133 children_type_0_item = children_type_0_item_data.to_dict() 134 elif isinstance(children_type_0_item_data, View): 135 children_type_0_item = children_type_0_item_data.to_dict() 136 elif isinstance(children_type_0_item_data, Text): 137 children_type_0_item = children_type_0_item_data.to_dict() 138 elif isinstance(children_type_0_item_data, Tiles): 139 children_type_0_item = children_type_0_item_data.to_dict() 140 elif isinstance(children_type_0_item_data, Rescaler): 141 children_type_0_item = children_type_0_item_data.to_dict() 142 else: 143 children_type_0_item = children_type_0_item_data.to_dict() 144 145 children.append(children_type_0_item) 146 147 else: 148 children = self.children 149 150 width: float | None | Unset 151 if isinstance(self.width, Unset): 152 width = UNSET 153 else: 154 width = self.width 155 156 height: float | None | Unset 157 if isinstance(self.height, Unset): 158 height = UNSET 159 else: 160 height = self.height 161 162 direction: None | str | Unset 163 if isinstance(self.direction, Unset): 164 direction = UNSET 165 elif isinstance(self.direction, ViewDirection): 166 direction = self.direction.value 167 else: 168 direction = self.direction 169 170 top: float | None | Unset 171 if isinstance(self.top, Unset): 172 top = UNSET 173 else: 174 top = self.top 175 176 left: float | None | Unset 177 if isinstance(self.left, Unset): 178 left = UNSET 179 else: 180 left = self.left 181 182 bottom: float | None | Unset 183 if isinstance(self.bottom, Unset): 184 bottom = UNSET 185 else: 186 bottom = self.bottom 187 188 right: float | None | Unset 189 if isinstance(self.right, Unset): 190 right = UNSET 191 else: 192 right = self.right 193 194 rotation: float | None | Unset 195 if isinstance(self.rotation, Unset): 196 rotation = UNSET 197 else: 198 rotation = self.rotation 199 200 transition: dict[str, Any] | None | Unset 201 if isinstance(self.transition, Unset): 202 transition = UNSET 203 elif isinstance(self.transition, Transition): 204 transition = self.transition.to_dict() 205 else: 206 transition = self.transition 207 208 overflow: None | str | Unset 209 if isinstance(self.overflow, Unset): 210 overflow = UNSET 211 elif isinstance(self.overflow, Overflow): 212 overflow = self.overflow.value 213 else: 214 overflow = self.overflow 215 216 background_color: None | str | Unset 217 if isinstance(self.background_color, Unset): 218 background_color = UNSET 219 else: 220 background_color = self.background_color 221 222 border_radius: float | None | Unset 223 if isinstance(self.border_radius, Unset): 224 border_radius = UNSET 225 else: 226 border_radius = self.border_radius 227 228 border_width: float | None | Unset 229 if isinstance(self.border_width, Unset): 230 border_width = UNSET 231 else: 232 border_width = self.border_width 233 234 border_color: None | str | Unset 235 if isinstance(self.border_color, Unset): 236 border_color = UNSET 237 else: 238 border_color = self.border_color 239 240 box_shadow: list[dict[str, Any]] | None | Unset 241 if isinstance(self.box_shadow, Unset): 242 box_shadow = UNSET 243 elif isinstance(self.box_shadow, list): 244 box_shadow = [] 245 for box_shadow_type_0_item_data in self.box_shadow: 246 box_shadow_type_0_item = box_shadow_type_0_item_data.to_dict() 247 box_shadow.append(box_shadow_type_0_item) 248 249 else: 250 box_shadow = self.box_shadow 251 252 padding: float | None | Unset 253 if isinstance(self.padding, Unset): 254 padding = UNSET 255 else: 256 padding = self.padding 257 258 padding_vertical: float | None | Unset 259 if isinstance(self.padding_vertical, Unset): 260 padding_vertical = UNSET 261 else: 262 padding_vertical = self.padding_vertical 263 264 padding_horizontal: float | None | Unset 265 if isinstance(self.padding_horizontal, Unset): 266 padding_horizontal = UNSET 267 else: 268 padding_horizontal = self.padding_horizontal 269 270 padding_top: float | None | Unset 271 if isinstance(self.padding_top, Unset): 272 padding_top = UNSET 273 else: 274 padding_top = self.padding_top 275 276 padding_right: float | None | Unset 277 if isinstance(self.padding_right, Unset): 278 padding_right = UNSET 279 else: 280 padding_right = self.padding_right 281 282 padding_bottom: float | None | Unset 283 if isinstance(self.padding_bottom, Unset): 284 padding_bottom = UNSET 285 else: 286 padding_bottom = self.padding_bottom 287 288 padding_left: float | None | Unset 289 if isinstance(self.padding_left, Unset): 290 padding_left = UNSET 291 else: 292 padding_left = self.padding_left 293 294 field_dict: dict[str, Any] = {} 295 296 field_dict.update({ 297 "type": type_, 298 }) 299 if id is not UNSET: 300 field_dict["id"] = id 301 if children is not UNSET: 302 field_dict["children"] = children 303 if width is not UNSET: 304 field_dict["width"] = width 305 if height is not UNSET: 306 field_dict["height"] = height 307 if direction is not UNSET: 308 field_dict["direction"] = direction 309 if top is not UNSET: 310 field_dict["top"] = top 311 if left is not UNSET: 312 field_dict["left"] = left 313 if bottom is not UNSET: 314 field_dict["bottom"] = bottom 315 if right is not UNSET: 316 field_dict["right"] = right 317 if rotation is not UNSET: 318 field_dict["rotation"] = rotation 319 if transition is not UNSET: 320 field_dict["transition"] = transition 321 if overflow is not UNSET: 322 field_dict["overflow"] = overflow 323 if background_color is not UNSET: 324 field_dict["background_color"] = background_color 325 if border_radius is not UNSET: 326 field_dict["border_radius"] = border_radius 327 if border_width is not UNSET: 328 field_dict["border_width"] = border_width 329 if border_color is not UNSET: 330 field_dict["border_color"] = border_color 331 if box_shadow is not UNSET: 332 field_dict["box_shadow"] = box_shadow 333 if padding is not UNSET: 334 field_dict["padding"] = padding 335 if padding_vertical is not UNSET: 336 field_dict["padding_vertical"] = padding_vertical 337 if padding_horizontal is not UNSET: 338 field_dict["padding_horizontal"] = padding_horizontal 339 if padding_top is not UNSET: 340 field_dict["padding_top"] = padding_top 341 if padding_right is not UNSET: 342 field_dict["padding_right"] = padding_right 343 if padding_bottom is not UNSET: 344 field_dict["padding_bottom"] = padding_bottom 345 if padding_left is not UNSET: 346 field_dict["padding_left"] = padding_left 347 348 return field_dict 349 350 @classmethod 351 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 352 from ..models.box_shadow import BoxShadow 353 from ..models.image import Image 354 from ..models.input_stream import InputStream 355 from ..models.rescaler import Rescaler 356 from ..models.text import Text 357 from ..models.tiles import Tiles 358 from ..models.transition import Transition 359 360 d = dict(src_dict) 361 type_ = ViewType(d.pop("type")) 362 363 def _parse_id(data: object) -> None | str | Unset: 364 if data is None: 365 return data 366 if isinstance(data, Unset): 367 return data 368 return cast(None | str | Unset, data) 369 370 id = _parse_id(d.pop("id", UNSET)) 371 372 def _parse_children( 373 data: object, 374 ) -> list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset: 375 if data is None: 376 return data 377 if isinstance(data, Unset): 378 return data 379 try: 380 if not isinstance(data, list): 381 raise TypeError() 382 children_type_0 = [] 383 _children_type_0 = data 384 for children_type_0_item_data in _children_type_0: 385 386 def _parse_children_type_0_item( 387 data: object, 388 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 389 try: 390 if not isinstance(data, dict): 391 raise TypeError() 392 componentsschemas_component_type_0 = InputStream.from_dict( 393 data 394 ) 395 396 return componentsschemas_component_type_0 397 except (TypeError, ValueError, AttributeError, KeyError): 398 pass 399 try: 400 if not isinstance(data, dict): 401 raise TypeError() 402 componentsschemas_component_type_1 = View.from_dict(data) 403 404 return componentsschemas_component_type_1 405 except (TypeError, ValueError, AttributeError, KeyError): 406 pass 407 try: 408 if not isinstance(data, dict): 409 raise TypeError() 410 componentsschemas_component_type_2 = Text.from_dict(data) 411 412 return componentsschemas_component_type_2 413 except (TypeError, ValueError, AttributeError, KeyError): 414 pass 415 try: 416 if not isinstance(data, dict): 417 raise TypeError() 418 componentsschemas_component_type_3 = Tiles.from_dict(data) 419 420 return componentsschemas_component_type_3 421 except (TypeError, ValueError, AttributeError, KeyError): 422 pass 423 try: 424 if not isinstance(data, dict): 425 raise TypeError() 426 componentsschemas_component_type_4 = Rescaler.from_dict( 427 data 428 ) 429 430 return componentsschemas_component_type_4 431 except (TypeError, ValueError, AttributeError, KeyError): 432 pass 433 if not isinstance(data, dict): 434 raise TypeError() 435 componentsschemas_component_type_5 = Image.from_dict(data) 436 437 return componentsschemas_component_type_5 438 439 children_type_0_item = _parse_children_type_0_item( 440 children_type_0_item_data 441 ) 442 443 children_type_0.append(children_type_0_item) 444 445 return children_type_0 446 except (TypeError, ValueError, AttributeError, KeyError): 447 pass 448 return cast( 449 list[Image | InputStream | Rescaler | Text | Tiles | View] 450 | None 451 | Unset, 452 data, 453 ) 454 455 children = _parse_children(d.pop("children", UNSET)) 456 457 def _parse_width(data: object) -> float | None | Unset: 458 if data is None: 459 return data 460 if isinstance(data, Unset): 461 return data 462 return cast(float | None | Unset, data) 463 464 width = _parse_width(d.pop("width", UNSET)) 465 466 def _parse_height(data: object) -> float | None | Unset: 467 if data is None: 468 return data 469 if isinstance(data, Unset): 470 return data 471 return cast(float | None | Unset, data) 472 473 height = _parse_height(d.pop("height", UNSET)) 474 475 def _parse_direction(data: object) -> None | Unset | ViewDirection: 476 if data is None: 477 return data 478 if isinstance(data, Unset): 479 return data 480 try: 481 if not isinstance(data, str): 482 raise TypeError() 483 direction_type_1 = ViewDirection(data) 484 485 return direction_type_1 486 except (TypeError, ValueError, AttributeError, KeyError): 487 pass 488 return cast(None | Unset | ViewDirection, data) 489 490 direction = _parse_direction(d.pop("direction", UNSET)) 491 492 def _parse_top(data: object) -> float | None | Unset: 493 if data is None: 494 return data 495 if isinstance(data, Unset): 496 return data 497 return cast(float | None | Unset, data) 498 499 top = _parse_top(d.pop("top", UNSET)) 500 501 def _parse_left(data: object) -> float | None | Unset: 502 if data is None: 503 return data 504 if isinstance(data, Unset): 505 return data 506 return cast(float | None | Unset, data) 507 508 left = _parse_left(d.pop("left", UNSET)) 509 510 def _parse_bottom(data: object) -> float | None | Unset: 511 if data is None: 512 return data 513 if isinstance(data, Unset): 514 return data 515 return cast(float | None | Unset, data) 516 517 bottom = _parse_bottom(d.pop("bottom", UNSET)) 518 519 def _parse_right(data: object) -> float | None | Unset: 520 if data is None: 521 return data 522 if isinstance(data, Unset): 523 return data 524 return cast(float | None | Unset, data) 525 526 right = _parse_right(d.pop("right", UNSET)) 527 528 def _parse_rotation(data: object) -> float | None | Unset: 529 if data is None: 530 return data 531 if isinstance(data, Unset): 532 return data 533 return cast(float | None | Unset, data) 534 535 rotation = _parse_rotation(d.pop("rotation", UNSET)) 536 537 def _parse_transition(data: object) -> None | Transition | Unset: 538 if data is None: 539 return data 540 if isinstance(data, Unset): 541 return data 542 try: 543 if not isinstance(data, dict): 544 raise TypeError() 545 transition_type_1 = Transition.from_dict(data) 546 547 return transition_type_1 548 except (TypeError, ValueError, AttributeError, KeyError): 549 pass 550 return cast(None | Transition | Unset, data) 551 552 transition = _parse_transition(d.pop("transition", UNSET)) 553 554 def _parse_overflow(data: object) -> None | Overflow | Unset: 555 if data is None: 556 return data 557 if isinstance(data, Unset): 558 return data 559 try: 560 if not isinstance(data, str): 561 raise TypeError() 562 overflow_type_1 = Overflow(data) 563 564 return overflow_type_1 565 except (TypeError, ValueError, AttributeError, KeyError): 566 pass 567 return cast(None | Overflow | Unset, data) 568 569 overflow = _parse_overflow(d.pop("overflow", UNSET)) 570 571 def _parse_background_color(data: object) -> None | str | Unset: 572 if data is None: 573 return data 574 if isinstance(data, Unset): 575 return data 576 return cast(None | str | Unset, data) 577 578 background_color = _parse_background_color(d.pop("background_color", UNSET)) 579 580 def _parse_border_radius(data: object) -> float | None | Unset: 581 if data is None: 582 return data 583 if isinstance(data, Unset): 584 return data 585 return cast(float | None | Unset, data) 586 587 border_radius = _parse_border_radius(d.pop("border_radius", UNSET)) 588 589 def _parse_border_width(data: object) -> float | None | Unset: 590 if data is None: 591 return data 592 if isinstance(data, Unset): 593 return data 594 return cast(float | None | Unset, data) 595 596 border_width = _parse_border_width(d.pop("border_width", UNSET)) 597 598 def _parse_border_color(data: object) -> None | str | Unset: 599 if data is None: 600 return data 601 if isinstance(data, Unset): 602 return data 603 return cast(None | str | Unset, data) 604 605 border_color = _parse_border_color(d.pop("border_color", UNSET)) 606 607 def _parse_box_shadow(data: object) -> list[BoxShadow] | None | Unset: 608 if data is None: 609 return data 610 if isinstance(data, Unset): 611 return data 612 try: 613 if not isinstance(data, list): 614 raise TypeError() 615 box_shadow_type_0 = [] 616 _box_shadow_type_0 = data 617 for box_shadow_type_0_item_data in _box_shadow_type_0: 618 box_shadow_type_0_item = BoxShadow.from_dict( 619 box_shadow_type_0_item_data 620 ) 621 622 box_shadow_type_0.append(box_shadow_type_0_item) 623 624 return box_shadow_type_0 625 except (TypeError, ValueError, AttributeError, KeyError): 626 pass 627 return cast(list[BoxShadow] | None | Unset, data) 628 629 box_shadow = _parse_box_shadow(d.pop("box_shadow", UNSET)) 630 631 def _parse_padding(data: object) -> float | None | Unset: 632 if data is None: 633 return data 634 if isinstance(data, Unset): 635 return data 636 return cast(float | None | Unset, data) 637 638 padding = _parse_padding(d.pop("padding", UNSET)) 639 640 def _parse_padding_vertical(data: object) -> float | None | Unset: 641 if data is None: 642 return data 643 if isinstance(data, Unset): 644 return data 645 return cast(float | None | Unset, data) 646 647 padding_vertical = _parse_padding_vertical(d.pop("padding_vertical", UNSET)) 648 649 def _parse_padding_horizontal(data: object) -> float | None | Unset: 650 if data is None: 651 return data 652 if isinstance(data, Unset): 653 return data 654 return cast(float | None | Unset, data) 655 656 padding_horizontal = _parse_padding_horizontal( 657 d.pop("padding_horizontal", UNSET) 658 ) 659 660 def _parse_padding_top(data: object) -> float | None | Unset: 661 if data is None: 662 return data 663 if isinstance(data, Unset): 664 return data 665 return cast(float | None | Unset, data) 666 667 padding_top = _parse_padding_top(d.pop("padding_top", UNSET)) 668 669 def _parse_padding_right(data: object) -> float | None | Unset: 670 if data is None: 671 return data 672 if isinstance(data, Unset): 673 return data 674 return cast(float | None | Unset, data) 675 676 padding_right = _parse_padding_right(d.pop("padding_right", UNSET)) 677 678 def _parse_padding_bottom(data: object) -> float | None | Unset: 679 if data is None: 680 return data 681 if isinstance(data, Unset): 682 return data 683 return cast(float | None | Unset, data) 684 685 padding_bottom = _parse_padding_bottom(d.pop("padding_bottom", UNSET)) 686 687 def _parse_padding_left(data: object) -> float | None | Unset: 688 if data is None: 689 return data 690 if isinstance(data, Unset): 691 return data 692 return cast(float | None | Unset, data) 693 694 padding_left = _parse_padding_left(d.pop("padding_left", UNSET)) 695 696 view = cls( 697 type_=type_, 698 id=id, 699 children=children, 700 width=width, 701 height=height, 702 direction=direction, 703 top=top, 704 left=left, 705 bottom=bottom, 706 right=right, 707 rotation=rotation, 708 transition=transition, 709 overflow=overflow, 710 background_color=background_color, 711 border_radius=border_radius, 712 border_width=border_width, 713 border_color=border_color, 714 box_shadow=box_shadow, 715 padding=padding, 716 padding_vertical=padding_vertical, 717 padding_horizontal=padding_horizontal, 718 padding_top=padding_top, 719 padding_right=padding_right, 720 padding_bottom=padding_bottom, 721 padding_left=padding_left, 722 ) 723 724 return view
Attributes:
- type_ (ViewType):
- id (None | str | Unset):
- children (list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset): List of component's children.
- width (float | None | Unset): Width of a component in pixels (without a border). Exact behavior might be
different
based on the parent component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- height (float | None | Unset): Height of a component in pixels (without a border). Exact behavior might be
different
based on the parent component:
- If the parent component is a layout, check sections "Absolute positioning" and "Static
- positioning" of that component.
- If the parent component is not a layout, then this field is required.
- direction (None | Unset | ViewDirection):
- top (float | None | Unset): Distance in pixels between this component's top edge and its parent's top edge (including a border). If this field is defined, then the component will ignore a layout defined by its parent.
- left (float | None | Unset): Distance in pixels between this component's left edge and its parent's left edge (including a border). If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- bottom (float | None | Unset): Distance in pixels between the bottom edge of this component and the bottom edge of its parent (including a border). If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- right (float | None | Unset): Distance in pixels between this component's right edge and its parent's right edge. If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- rotation (float | None | Unset): Rotation of a component in degrees. If this field is defined, this element will be absolutely positioned, instead of being laid out by its parent.
- transition (None | Transition | Unset):
- overflow (None | Overflow | Unset):
- background_color (None | str | Unset):
- border_radius (float | None | Unset): (default=
0.0) Radius of a rounded corner. - border_width (float | None | Unset): (default=
0.0) Border width. - border_color (None | str | Unset):
- box_shadow (list[BoxShadow] | None | Unset): List of box shadows.
- padding (float | None | Unset): (default=
0.0) Padding for all sides of the component. - padding_vertical (float | None | Unset): (default=
0.0) Padding for the top and bottom of the component. - padding_horizontal (float | None | Unset): (default=
0.0) Padding for the left and right of the component. - padding_top (float | None | Unset): (default=
0.0) Padding on top side in pixels. - padding_right (float | None | Unset): (default=
0.0) Padding on right side in pixels. - padding_bottom (float | None | Unset): (default=
0.0) Padding on bottom side in pixels. - padding_left (float | None | Unset): (default=
0.0) Padding on left side in pixels.
47def __init__(self, type_, id=attr_dict['id'].default, children=attr_dict['children'].default, width=attr_dict['width'].default, height=attr_dict['height'].default, direction=attr_dict['direction'].default, top=attr_dict['top'].default, left=attr_dict['left'].default, bottom=attr_dict['bottom'].default, right=attr_dict['right'].default, rotation=attr_dict['rotation'].default, transition=attr_dict['transition'].default, overflow=attr_dict['overflow'].default, background_color=attr_dict['background_color'].default, border_radius=attr_dict['border_radius'].default, border_width=attr_dict['border_width'].default, border_color=attr_dict['border_color'].default, box_shadow=attr_dict['box_shadow'].default, padding=attr_dict['padding'].default, padding_vertical=attr_dict['padding_vertical'].default, padding_horizontal=attr_dict['padding_horizontal'].default, padding_top=attr_dict['padding_top'].default, padding_right=attr_dict['padding_right'].default, padding_bottom=attr_dict['padding_bottom'].default, padding_left=attr_dict['padding_left'].default): 48 self.type_ = type_ 49 self.id = id 50 self.children = children 51 self.width = width 52 self.height = height 53 self.direction = direction 54 self.top = top 55 self.left = left 56 self.bottom = bottom 57 self.right = right 58 self.rotation = rotation 59 self.transition = transition 60 self.overflow = overflow 61 self.background_color = background_color 62 self.border_radius = border_radius 63 self.border_width = border_width 64 self.border_color = border_color 65 self.box_shadow = box_shadow 66 self.padding = padding 67 self.padding_vertical = padding_vertical 68 self.padding_horizontal = padding_horizontal 69 self.padding_top = padding_top 70 self.padding_right = padding_right 71 self.padding_bottom = padding_bottom 72 self.padding_left = padding_left
Method generated by attrs for class View.
110 def to_dict(self) -> dict[str, Any]: 111 from ..models.input_stream import InputStream 112 from ..models.rescaler import Rescaler 113 from ..models.text import Text 114 from ..models.tiles import Tiles 115 from ..models.transition import Transition 116 117 type_ = self.type_.value 118 119 id: None | str | Unset 120 if isinstance(self.id, Unset): 121 id = UNSET 122 else: 123 id = self.id 124 125 children: list[dict[str, Any]] | None | Unset 126 if isinstance(self.children, Unset): 127 children = UNSET 128 elif isinstance(self.children, list): 129 children = [] 130 for children_type_0_item_data in self.children: 131 children_type_0_item: dict[str, Any] 132 if isinstance(children_type_0_item_data, InputStream): 133 children_type_0_item = children_type_0_item_data.to_dict() 134 elif isinstance(children_type_0_item_data, View): 135 children_type_0_item = children_type_0_item_data.to_dict() 136 elif isinstance(children_type_0_item_data, Text): 137 children_type_0_item = children_type_0_item_data.to_dict() 138 elif isinstance(children_type_0_item_data, Tiles): 139 children_type_0_item = children_type_0_item_data.to_dict() 140 elif isinstance(children_type_0_item_data, Rescaler): 141 children_type_0_item = children_type_0_item_data.to_dict() 142 else: 143 children_type_0_item = children_type_0_item_data.to_dict() 144 145 children.append(children_type_0_item) 146 147 else: 148 children = self.children 149 150 width: float | None | Unset 151 if isinstance(self.width, Unset): 152 width = UNSET 153 else: 154 width = self.width 155 156 height: float | None | Unset 157 if isinstance(self.height, Unset): 158 height = UNSET 159 else: 160 height = self.height 161 162 direction: None | str | Unset 163 if isinstance(self.direction, Unset): 164 direction = UNSET 165 elif isinstance(self.direction, ViewDirection): 166 direction = self.direction.value 167 else: 168 direction = self.direction 169 170 top: float | None | Unset 171 if isinstance(self.top, Unset): 172 top = UNSET 173 else: 174 top = self.top 175 176 left: float | None | Unset 177 if isinstance(self.left, Unset): 178 left = UNSET 179 else: 180 left = self.left 181 182 bottom: float | None | Unset 183 if isinstance(self.bottom, Unset): 184 bottom = UNSET 185 else: 186 bottom = self.bottom 187 188 right: float | None | Unset 189 if isinstance(self.right, Unset): 190 right = UNSET 191 else: 192 right = self.right 193 194 rotation: float | None | Unset 195 if isinstance(self.rotation, Unset): 196 rotation = UNSET 197 else: 198 rotation = self.rotation 199 200 transition: dict[str, Any] | None | Unset 201 if isinstance(self.transition, Unset): 202 transition = UNSET 203 elif isinstance(self.transition, Transition): 204 transition = self.transition.to_dict() 205 else: 206 transition = self.transition 207 208 overflow: None | str | Unset 209 if isinstance(self.overflow, Unset): 210 overflow = UNSET 211 elif isinstance(self.overflow, Overflow): 212 overflow = self.overflow.value 213 else: 214 overflow = self.overflow 215 216 background_color: None | str | Unset 217 if isinstance(self.background_color, Unset): 218 background_color = UNSET 219 else: 220 background_color = self.background_color 221 222 border_radius: float | None | Unset 223 if isinstance(self.border_radius, Unset): 224 border_radius = UNSET 225 else: 226 border_radius = self.border_radius 227 228 border_width: float | None | Unset 229 if isinstance(self.border_width, Unset): 230 border_width = UNSET 231 else: 232 border_width = self.border_width 233 234 border_color: None | str | Unset 235 if isinstance(self.border_color, Unset): 236 border_color = UNSET 237 else: 238 border_color = self.border_color 239 240 box_shadow: list[dict[str, Any]] | None | Unset 241 if isinstance(self.box_shadow, Unset): 242 box_shadow = UNSET 243 elif isinstance(self.box_shadow, list): 244 box_shadow = [] 245 for box_shadow_type_0_item_data in self.box_shadow: 246 box_shadow_type_0_item = box_shadow_type_0_item_data.to_dict() 247 box_shadow.append(box_shadow_type_0_item) 248 249 else: 250 box_shadow = self.box_shadow 251 252 padding: float | None | Unset 253 if isinstance(self.padding, Unset): 254 padding = UNSET 255 else: 256 padding = self.padding 257 258 padding_vertical: float | None | Unset 259 if isinstance(self.padding_vertical, Unset): 260 padding_vertical = UNSET 261 else: 262 padding_vertical = self.padding_vertical 263 264 padding_horizontal: float | None | Unset 265 if isinstance(self.padding_horizontal, Unset): 266 padding_horizontal = UNSET 267 else: 268 padding_horizontal = self.padding_horizontal 269 270 padding_top: float | None | Unset 271 if isinstance(self.padding_top, Unset): 272 padding_top = UNSET 273 else: 274 padding_top = self.padding_top 275 276 padding_right: float | None | Unset 277 if isinstance(self.padding_right, Unset): 278 padding_right = UNSET 279 else: 280 padding_right = self.padding_right 281 282 padding_bottom: float | None | Unset 283 if isinstance(self.padding_bottom, Unset): 284 padding_bottom = UNSET 285 else: 286 padding_bottom = self.padding_bottom 287 288 padding_left: float | None | Unset 289 if isinstance(self.padding_left, Unset): 290 padding_left = UNSET 291 else: 292 padding_left = self.padding_left 293 294 field_dict: dict[str, Any] = {} 295 296 field_dict.update({ 297 "type": type_, 298 }) 299 if id is not UNSET: 300 field_dict["id"] = id 301 if children is not UNSET: 302 field_dict["children"] = children 303 if width is not UNSET: 304 field_dict["width"] = width 305 if height is not UNSET: 306 field_dict["height"] = height 307 if direction is not UNSET: 308 field_dict["direction"] = direction 309 if top is not UNSET: 310 field_dict["top"] = top 311 if left is not UNSET: 312 field_dict["left"] = left 313 if bottom is not UNSET: 314 field_dict["bottom"] = bottom 315 if right is not UNSET: 316 field_dict["right"] = right 317 if rotation is not UNSET: 318 field_dict["rotation"] = rotation 319 if transition is not UNSET: 320 field_dict["transition"] = transition 321 if overflow is not UNSET: 322 field_dict["overflow"] = overflow 323 if background_color is not UNSET: 324 field_dict["background_color"] = background_color 325 if border_radius is not UNSET: 326 field_dict["border_radius"] = border_radius 327 if border_width is not UNSET: 328 field_dict["border_width"] = border_width 329 if border_color is not UNSET: 330 field_dict["border_color"] = border_color 331 if box_shadow is not UNSET: 332 field_dict["box_shadow"] = box_shadow 333 if padding is not UNSET: 334 field_dict["padding"] = padding 335 if padding_vertical is not UNSET: 336 field_dict["padding_vertical"] = padding_vertical 337 if padding_horizontal is not UNSET: 338 field_dict["padding_horizontal"] = padding_horizontal 339 if padding_top is not UNSET: 340 field_dict["padding_top"] = padding_top 341 if padding_right is not UNSET: 342 field_dict["padding_right"] = padding_right 343 if padding_bottom is not UNSET: 344 field_dict["padding_bottom"] = padding_bottom 345 if padding_left is not UNSET: 346 field_dict["padding_left"] = padding_left 347 348 return field_dict
350 @classmethod 351 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 352 from ..models.box_shadow import BoxShadow 353 from ..models.image import Image 354 from ..models.input_stream import InputStream 355 from ..models.rescaler import Rescaler 356 from ..models.text import Text 357 from ..models.tiles import Tiles 358 from ..models.transition import Transition 359 360 d = dict(src_dict) 361 type_ = ViewType(d.pop("type")) 362 363 def _parse_id(data: object) -> None | str | Unset: 364 if data is None: 365 return data 366 if isinstance(data, Unset): 367 return data 368 return cast(None | str | Unset, data) 369 370 id = _parse_id(d.pop("id", UNSET)) 371 372 def _parse_children( 373 data: object, 374 ) -> list[Image | InputStream | Rescaler | Text | Tiles | View] | None | Unset: 375 if data is None: 376 return data 377 if isinstance(data, Unset): 378 return data 379 try: 380 if not isinstance(data, list): 381 raise TypeError() 382 children_type_0 = [] 383 _children_type_0 = data 384 for children_type_0_item_data in _children_type_0: 385 386 def _parse_children_type_0_item( 387 data: object, 388 ) -> Image | InputStream | Rescaler | Text | Tiles | View: 389 try: 390 if not isinstance(data, dict): 391 raise TypeError() 392 componentsschemas_component_type_0 = InputStream.from_dict( 393 data 394 ) 395 396 return componentsschemas_component_type_0 397 except (TypeError, ValueError, AttributeError, KeyError): 398 pass 399 try: 400 if not isinstance(data, dict): 401 raise TypeError() 402 componentsschemas_component_type_1 = View.from_dict(data) 403 404 return componentsschemas_component_type_1 405 except (TypeError, ValueError, AttributeError, KeyError): 406 pass 407 try: 408 if not isinstance(data, dict): 409 raise TypeError() 410 componentsschemas_component_type_2 = Text.from_dict(data) 411 412 return componentsschemas_component_type_2 413 except (TypeError, ValueError, AttributeError, KeyError): 414 pass 415 try: 416 if not isinstance(data, dict): 417 raise TypeError() 418 componentsschemas_component_type_3 = Tiles.from_dict(data) 419 420 return componentsschemas_component_type_3 421 except (TypeError, ValueError, AttributeError, KeyError): 422 pass 423 try: 424 if not isinstance(data, dict): 425 raise TypeError() 426 componentsschemas_component_type_4 = Rescaler.from_dict( 427 data 428 ) 429 430 return componentsschemas_component_type_4 431 except (TypeError, ValueError, AttributeError, KeyError): 432 pass 433 if not isinstance(data, dict): 434 raise TypeError() 435 componentsschemas_component_type_5 = Image.from_dict(data) 436 437 return componentsschemas_component_type_5 438 439 children_type_0_item = _parse_children_type_0_item( 440 children_type_0_item_data 441 ) 442 443 children_type_0.append(children_type_0_item) 444 445 return children_type_0 446 except (TypeError, ValueError, AttributeError, KeyError): 447 pass 448 return cast( 449 list[Image | InputStream | Rescaler | Text | Tiles | View] 450 | None 451 | Unset, 452 data, 453 ) 454 455 children = _parse_children(d.pop("children", UNSET)) 456 457 def _parse_width(data: object) -> float | None | Unset: 458 if data is None: 459 return data 460 if isinstance(data, Unset): 461 return data 462 return cast(float | None | Unset, data) 463 464 width = _parse_width(d.pop("width", UNSET)) 465 466 def _parse_height(data: object) -> float | None | Unset: 467 if data is None: 468 return data 469 if isinstance(data, Unset): 470 return data 471 return cast(float | None | Unset, data) 472 473 height = _parse_height(d.pop("height", UNSET)) 474 475 def _parse_direction(data: object) -> None | Unset | ViewDirection: 476 if data is None: 477 return data 478 if isinstance(data, Unset): 479 return data 480 try: 481 if not isinstance(data, str): 482 raise TypeError() 483 direction_type_1 = ViewDirection(data) 484 485 return direction_type_1 486 except (TypeError, ValueError, AttributeError, KeyError): 487 pass 488 return cast(None | Unset | ViewDirection, data) 489 490 direction = _parse_direction(d.pop("direction", UNSET)) 491 492 def _parse_top(data: object) -> float | None | Unset: 493 if data is None: 494 return data 495 if isinstance(data, Unset): 496 return data 497 return cast(float | None | Unset, data) 498 499 top = _parse_top(d.pop("top", UNSET)) 500 501 def _parse_left(data: object) -> float | None | Unset: 502 if data is None: 503 return data 504 if isinstance(data, Unset): 505 return data 506 return cast(float | None | Unset, data) 507 508 left = _parse_left(d.pop("left", UNSET)) 509 510 def _parse_bottom(data: object) -> float | None | Unset: 511 if data is None: 512 return data 513 if isinstance(data, Unset): 514 return data 515 return cast(float | None | Unset, data) 516 517 bottom = _parse_bottom(d.pop("bottom", UNSET)) 518 519 def _parse_right(data: object) -> float | None | Unset: 520 if data is None: 521 return data 522 if isinstance(data, Unset): 523 return data 524 return cast(float | None | Unset, data) 525 526 right = _parse_right(d.pop("right", UNSET)) 527 528 def _parse_rotation(data: object) -> float | None | Unset: 529 if data is None: 530 return data 531 if isinstance(data, Unset): 532 return data 533 return cast(float | None | Unset, data) 534 535 rotation = _parse_rotation(d.pop("rotation", UNSET)) 536 537 def _parse_transition(data: object) -> None | Transition | Unset: 538 if data is None: 539 return data 540 if isinstance(data, Unset): 541 return data 542 try: 543 if not isinstance(data, dict): 544 raise TypeError() 545 transition_type_1 = Transition.from_dict(data) 546 547 return transition_type_1 548 except (TypeError, ValueError, AttributeError, KeyError): 549 pass 550 return cast(None | Transition | Unset, data) 551 552 transition = _parse_transition(d.pop("transition", UNSET)) 553 554 def _parse_overflow(data: object) -> None | Overflow | Unset: 555 if data is None: 556 return data 557 if isinstance(data, Unset): 558 return data 559 try: 560 if not isinstance(data, str): 561 raise TypeError() 562 overflow_type_1 = Overflow(data) 563 564 return overflow_type_1 565 except (TypeError, ValueError, AttributeError, KeyError): 566 pass 567 return cast(None | Overflow | Unset, data) 568 569 overflow = _parse_overflow(d.pop("overflow", UNSET)) 570 571 def _parse_background_color(data: object) -> None | str | Unset: 572 if data is None: 573 return data 574 if isinstance(data, Unset): 575 return data 576 return cast(None | str | Unset, data) 577 578 background_color = _parse_background_color(d.pop("background_color", UNSET)) 579 580 def _parse_border_radius(data: object) -> float | None | Unset: 581 if data is None: 582 return data 583 if isinstance(data, Unset): 584 return data 585 return cast(float | None | Unset, data) 586 587 border_radius = _parse_border_radius(d.pop("border_radius", UNSET)) 588 589 def _parse_border_width(data: object) -> float | None | Unset: 590 if data is None: 591 return data 592 if isinstance(data, Unset): 593 return data 594 return cast(float | None | Unset, data) 595 596 border_width = _parse_border_width(d.pop("border_width", UNSET)) 597 598 def _parse_border_color(data: object) -> None | str | Unset: 599 if data is None: 600 return data 601 if isinstance(data, Unset): 602 return data 603 return cast(None | str | Unset, data) 604 605 border_color = _parse_border_color(d.pop("border_color", UNSET)) 606 607 def _parse_box_shadow(data: object) -> list[BoxShadow] | None | Unset: 608 if data is None: 609 return data 610 if isinstance(data, Unset): 611 return data 612 try: 613 if not isinstance(data, list): 614 raise TypeError() 615 box_shadow_type_0 = [] 616 _box_shadow_type_0 = data 617 for box_shadow_type_0_item_data in _box_shadow_type_0: 618 box_shadow_type_0_item = BoxShadow.from_dict( 619 box_shadow_type_0_item_data 620 ) 621 622 box_shadow_type_0.append(box_shadow_type_0_item) 623 624 return box_shadow_type_0 625 except (TypeError, ValueError, AttributeError, KeyError): 626 pass 627 return cast(list[BoxShadow] | None | Unset, data) 628 629 box_shadow = _parse_box_shadow(d.pop("box_shadow", UNSET)) 630 631 def _parse_padding(data: object) -> float | None | Unset: 632 if data is None: 633 return data 634 if isinstance(data, Unset): 635 return data 636 return cast(float | None | Unset, data) 637 638 padding = _parse_padding(d.pop("padding", UNSET)) 639 640 def _parse_padding_vertical(data: object) -> float | None | Unset: 641 if data is None: 642 return data 643 if isinstance(data, Unset): 644 return data 645 return cast(float | None | Unset, data) 646 647 padding_vertical = _parse_padding_vertical(d.pop("padding_vertical", UNSET)) 648 649 def _parse_padding_horizontal(data: object) -> float | None | Unset: 650 if data is None: 651 return data 652 if isinstance(data, Unset): 653 return data 654 return cast(float | None | Unset, data) 655 656 padding_horizontal = _parse_padding_horizontal( 657 d.pop("padding_horizontal", UNSET) 658 ) 659 660 def _parse_padding_top(data: object) -> float | None | Unset: 661 if data is None: 662 return data 663 if isinstance(data, Unset): 664 return data 665 return cast(float | None | Unset, data) 666 667 padding_top = _parse_padding_top(d.pop("padding_top", UNSET)) 668 669 def _parse_padding_right(data: object) -> float | None | Unset: 670 if data is None: 671 return data 672 if isinstance(data, Unset): 673 return data 674 return cast(float | None | Unset, data) 675 676 padding_right = _parse_padding_right(d.pop("padding_right", UNSET)) 677 678 def _parse_padding_bottom(data: object) -> float | None | Unset: 679 if data is None: 680 return data 681 if isinstance(data, Unset): 682 return data 683 return cast(float | None | Unset, data) 684 685 padding_bottom = _parse_padding_bottom(d.pop("padding_bottom", UNSET)) 686 687 def _parse_padding_left(data: object) -> float | None | Unset: 688 if data is None: 689 return data 690 if isinstance(data, Unset): 691 return data 692 return cast(float | None | Unset, data) 693 694 padding_left = _parse_padding_left(d.pop("padding_left", UNSET)) 695 696 view = cls( 697 type_=type_, 698 id=id, 699 children=children, 700 width=width, 701 height=height, 702 direction=direction, 703 top=top, 704 left=left, 705 bottom=bottom, 706 right=right, 707 rotation=rotation, 708 transition=transition, 709 overflow=overflow, 710 background_color=background_color, 711 border_radius=border_radius, 712 border_width=border_width, 713 border_color=border_color, 714 box_shadow=box_shadow, 715 padding=padding, 716 padding_vertical=padding_vertical, 717 padding_horizontal=padding_horizontal, 718 padding_top=padding_top, 719 padding_right=padding_right, 720 padding_bottom=padding_bottom, 721 padding_left=padding_left, 722 ) 723 724 return view
5class ViewDirection(str, Enum): 6 """None""" 7 8 COLUMN = "column" 9 ROW = "row" 10 11 def __str__(self) -> str: 12 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
5class ViewType(str, Enum): 6 """None""" 7 8 VIEW = "view" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class WhepInput: 17 """ 18 Attributes: 19 endpoint_url (str): WHEP server endpoint URL 20 type_ (WhepInputType): 21 bearer_token (None | str | Unset): Optional Bearer token for auth 22 video (bool | None | Unset): If `true`, requests a h264-encoded video track. 23 If not provided, it defaults to `true` 24 """ 25 26 endpoint_url: str 27 type_: WhepInputType 28 bearer_token: None | str | Unset = UNSET 29 video: bool | None | Unset = UNSET 30 31 def to_dict(self) -> dict[str, Any]: 32 endpoint_url = self.endpoint_url 33 34 type_ = self.type_.value 35 36 bearer_token: None | str | Unset 37 if isinstance(self.bearer_token, Unset): 38 bearer_token = UNSET 39 else: 40 bearer_token = self.bearer_token 41 42 video: bool | None | Unset 43 if isinstance(self.video, Unset): 44 video = UNSET 45 else: 46 video = self.video 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "endpoint_url": endpoint_url, 52 "type": type_, 53 }) 54 if bearer_token is not UNSET: 55 field_dict["bearer_token"] = bearer_token 56 if video is not UNSET: 57 field_dict["video"] = video 58 59 return field_dict 60 61 @classmethod 62 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 63 d = dict(src_dict) 64 endpoint_url = d.pop("endpoint_url") 65 66 type_ = WhepInputType(d.pop("type")) 67 68 def _parse_bearer_token(data: object) -> None | str | Unset: 69 if data is None: 70 return data 71 if isinstance(data, Unset): 72 return data 73 return cast(None | str | Unset, data) 74 75 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 76 77 def _parse_video(data: object) -> bool | None | Unset: 78 if data is None: 79 return data 80 if isinstance(data, Unset): 81 return data 82 return cast(bool | None | Unset, data) 83 84 video = _parse_video(d.pop("video", UNSET)) 85 86 whep_input = cls( 87 endpoint_url=endpoint_url, 88 type_=type_, 89 bearer_token=bearer_token, 90 video=video, 91 ) 92 93 return whep_input
Attributes:
- endpoint_url (str): WHEP server endpoint URL
- type_ (WhepInputType):
- bearer_token (None | str | Unset): Optional Bearer token for auth
- video (bool | None | Unset): If
true, requests a h264-encoded video track. If not provided, it defaults totrue
26def __init__(self, endpoint_url, type_, bearer_token=attr_dict['bearer_token'].default, video=attr_dict['video'].default): 27 self.endpoint_url = endpoint_url 28 self.type_ = type_ 29 self.bearer_token = bearer_token 30 self.video = video
Method generated by attrs for class WhepInput.
31 def to_dict(self) -> dict[str, Any]: 32 endpoint_url = self.endpoint_url 33 34 type_ = self.type_.value 35 36 bearer_token: None | str | Unset 37 if isinstance(self.bearer_token, Unset): 38 bearer_token = UNSET 39 else: 40 bearer_token = self.bearer_token 41 42 video: bool | None | Unset 43 if isinstance(self.video, Unset): 44 video = UNSET 45 else: 46 video = self.video 47 48 field_dict: dict[str, Any] = {} 49 50 field_dict.update({ 51 "endpoint_url": endpoint_url, 52 "type": type_, 53 }) 54 if bearer_token is not UNSET: 55 field_dict["bearer_token"] = bearer_token 56 if video is not UNSET: 57 field_dict["video"] = video 58 59 return field_dict
61 @classmethod 62 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 63 d = dict(src_dict) 64 endpoint_url = d.pop("endpoint_url") 65 66 type_ = WhepInputType(d.pop("type")) 67 68 def _parse_bearer_token(data: object) -> None | str | Unset: 69 if data is None: 70 return data 71 if isinstance(data, Unset): 72 return data 73 return cast(None | str | Unset, data) 74 75 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 76 77 def _parse_video(data: object) -> bool | None | Unset: 78 if data is None: 79 return data 80 if isinstance(data, Unset): 81 return data 82 return cast(bool | None | Unset, data) 83 84 video = _parse_video(d.pop("video", UNSET)) 85 86 whep_input = cls( 87 endpoint_url=endpoint_url, 88 type_=type_, 89 bearer_token=bearer_token, 90 video=video, 91 ) 92 93 return whep_input
5class WhepInputType(str, Enum): 6 """None""" 7 8 WHEP_CLIENT = "whep_client" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class WhipAudioEncoderOptionsAny: 17 """ 18 Attributes: 19 type_ (WhipAudioEncoderOptionsAnyType): 20 """ 21 22 type_: WhipAudioEncoderOptionsAnyType 23 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 24 25 def to_dict(self) -> dict[str, Any]: 26 type_ = self.type_.value 27 28 field_dict: dict[str, Any] = {} 29 field_dict.update(self.additional_properties) 30 field_dict.update({ 31 "type": type_, 32 }) 33 34 return field_dict 35 36 @classmethod 37 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 38 d = dict(src_dict) 39 type_ = WhipAudioEncoderOptionsAnyType(d.pop("type")) 40 41 whip_audio_encoder_options_any = cls( 42 type_=type_, 43 ) 44 45 whip_audio_encoder_options_any.additional_properties = d 46 return whip_audio_encoder_options_any 47 48 @property 49 def additional_keys(self) -> list[str]: 50 return list(self.additional_properties.keys()) 51 52 def __getitem__(self, key: str) -> Any: 53 return self.additional_properties[key] 54 55 def __setitem__(self, key: str, value: Any) -> None: 56 self.additional_properties[key] = value 57 58 def __delitem__(self, key: str) -> None: 59 del self.additional_properties[key] 60 61 def __contains__(self, key: str) -> bool: 62 return key in self.additional_properties
Attributes:
- type_ (WhipAudioEncoderOptionsAnyType):
24def __init__(self, type_): 25 self.type_ = type_ 26 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class WhipAudioEncoderOptionsAny.
36 @classmethod 37 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 38 d = dict(src_dict) 39 type_ = WhipAudioEncoderOptionsAnyType(d.pop("type")) 40 41 whip_audio_encoder_options_any = cls( 42 type_=type_, 43 ) 44 45 whip_audio_encoder_options_any.additional_properties = d 46 return whip_audio_encoder_options_any
5class WhipAudioEncoderOptionsAnyType(str, Enum): 6 """None""" 7 8 ANY = "any" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
19@_attrs_define 20class WhipAudioEncoderOptionsOpus: 21 """ 22 Attributes: 23 type_ (WhipAudioEncoderOptionsOpusType): 24 preset (None | OpusEncoderPreset | Unset): 25 sample_rate (int | None | Unset): (**default=`48000`**) Sample rate. Allowed values: [8000, 16000, 24000, 26 48000]. 27 forward_error_correction (bool | None | Unset): (**default=`false`**) Specifies if forward error correction 28 (FEC) should be used. 29 """ 30 31 type_: WhipAudioEncoderOptionsOpusType 32 preset: None | OpusEncoderPreset | Unset = UNSET 33 sample_rate: int | None | Unset = UNSET 34 forward_error_correction: bool | None | Unset = UNSET 35 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 36 37 def to_dict(self) -> dict[str, Any]: 38 type_ = self.type_.value 39 40 preset: None | str | Unset 41 if isinstance(self.preset, Unset): 42 preset = UNSET 43 elif isinstance(self.preset, OpusEncoderPreset): 44 preset = self.preset.value 45 else: 46 preset = self.preset 47 48 sample_rate: int | None | Unset 49 if isinstance(self.sample_rate, Unset): 50 sample_rate = UNSET 51 else: 52 sample_rate = self.sample_rate 53 54 forward_error_correction: bool | None | Unset 55 if isinstance(self.forward_error_correction, Unset): 56 forward_error_correction = UNSET 57 else: 58 forward_error_correction = self.forward_error_correction 59 60 field_dict: dict[str, Any] = {} 61 field_dict.update(self.additional_properties) 62 field_dict.update({ 63 "type": type_, 64 }) 65 if preset is not UNSET: 66 field_dict["preset"] = preset 67 if sample_rate is not UNSET: 68 field_dict["sample_rate"] = sample_rate 69 if forward_error_correction is not UNSET: 70 field_dict["forward_error_correction"] = forward_error_correction 71 72 return field_dict 73 74 @classmethod 75 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 76 d = dict(src_dict) 77 type_ = WhipAudioEncoderOptionsOpusType(d.pop("type")) 78 79 def _parse_preset(data: object) -> None | OpusEncoderPreset | Unset: 80 if data is None: 81 return data 82 if isinstance(data, Unset): 83 return data 84 try: 85 if not isinstance(data, str): 86 raise TypeError() 87 preset_type_1 = OpusEncoderPreset(data) 88 89 return preset_type_1 90 except (TypeError, ValueError, AttributeError, KeyError): 91 pass 92 return cast(None | OpusEncoderPreset | Unset, data) 93 94 preset = _parse_preset(d.pop("preset", UNSET)) 95 96 def _parse_sample_rate(data: object) -> int | None | Unset: 97 if data is None: 98 return data 99 if isinstance(data, Unset): 100 return data 101 return cast(int | None | Unset, data) 102 103 sample_rate = _parse_sample_rate(d.pop("sample_rate", UNSET)) 104 105 def _parse_forward_error_correction(data: object) -> bool | None | Unset: 106 if data is None: 107 return data 108 if isinstance(data, Unset): 109 return data 110 return cast(bool | None | Unset, data) 111 112 forward_error_correction = _parse_forward_error_correction( 113 d.pop("forward_error_correction", UNSET) 114 ) 115 116 whip_audio_encoder_options_opus = cls( 117 type_=type_, 118 preset=preset, 119 sample_rate=sample_rate, 120 forward_error_correction=forward_error_correction, 121 ) 122 123 whip_audio_encoder_options_opus.additional_properties = d 124 return whip_audio_encoder_options_opus 125 126 @property 127 def additional_keys(self) -> list[str]: 128 return list(self.additional_properties.keys()) 129 130 def __getitem__(self, key: str) -> Any: 131 return self.additional_properties[key] 132 133 def __setitem__(self, key: str, value: Any) -> None: 134 self.additional_properties[key] = value 135 136 def __delitem__(self, key: str) -> None: 137 del self.additional_properties[key] 138 139 def __contains__(self, key: str) -> bool: 140 return key in self.additional_properties
Attributes:
- type_ (WhipAudioEncoderOptionsOpusType):
- preset (None | OpusEncoderPreset | Unset):
- sample_rate (int | None | Unset): (default=
48000) Sample rate. Allowed values: [8000, 16000, 24000, 48000]. - forward_error_correction (bool | None | Unset): (default=
false) Specifies if forward error correction (FEC) should be used.
27def __init__(self, type_, preset=attr_dict['preset'].default, sample_rate=attr_dict['sample_rate'].default, forward_error_correction=attr_dict['forward_error_correction'].default): 28 self.type_ = type_ 29 self.preset = preset 30 self.sample_rate = sample_rate 31 self.forward_error_correction = forward_error_correction 32 self.additional_properties = __attr_factory_additional_properties()
Method generated by attrs for class WhipAudioEncoderOptionsOpus.
37 def to_dict(self) -> dict[str, Any]: 38 type_ = self.type_.value 39 40 preset: None | str | Unset 41 if isinstance(self.preset, Unset): 42 preset = UNSET 43 elif isinstance(self.preset, OpusEncoderPreset): 44 preset = self.preset.value 45 else: 46 preset = self.preset 47 48 sample_rate: int | None | Unset 49 if isinstance(self.sample_rate, Unset): 50 sample_rate = UNSET 51 else: 52 sample_rate = self.sample_rate 53 54 forward_error_correction: bool | None | Unset 55 if isinstance(self.forward_error_correction, Unset): 56 forward_error_correction = UNSET 57 else: 58 forward_error_correction = self.forward_error_correction 59 60 field_dict: dict[str, Any] = {} 61 field_dict.update(self.additional_properties) 62 field_dict.update({ 63 "type": type_, 64 }) 65 if preset is not UNSET: 66 field_dict["preset"] = preset 67 if sample_rate is not UNSET: 68 field_dict["sample_rate"] = sample_rate 69 if forward_error_correction is not UNSET: 70 field_dict["forward_error_correction"] = forward_error_correction 71 72 return field_dict
74 @classmethod 75 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 76 d = dict(src_dict) 77 type_ = WhipAudioEncoderOptionsOpusType(d.pop("type")) 78 79 def _parse_preset(data: object) -> None | OpusEncoderPreset | Unset: 80 if data is None: 81 return data 82 if isinstance(data, Unset): 83 return data 84 try: 85 if not isinstance(data, str): 86 raise TypeError() 87 preset_type_1 = OpusEncoderPreset(data) 88 89 return preset_type_1 90 except (TypeError, ValueError, AttributeError, KeyError): 91 pass 92 return cast(None | OpusEncoderPreset | Unset, data) 93 94 preset = _parse_preset(d.pop("preset", UNSET)) 95 96 def _parse_sample_rate(data: object) -> int | None | Unset: 97 if data is None: 98 return data 99 if isinstance(data, Unset): 100 return data 101 return cast(int | None | Unset, data) 102 103 sample_rate = _parse_sample_rate(d.pop("sample_rate", UNSET)) 104 105 def _parse_forward_error_correction(data: object) -> bool | None | Unset: 106 if data is None: 107 return data 108 if isinstance(data, Unset): 109 return data 110 return cast(bool | None | Unset, data) 111 112 forward_error_correction = _parse_forward_error_correction( 113 d.pop("forward_error_correction", UNSET) 114 ) 115 116 whip_audio_encoder_options_opus = cls( 117 type_=type_, 118 preset=preset, 119 sample_rate=sample_rate, 120 forward_error_correction=forward_error_correction, 121 ) 122 123 whip_audio_encoder_options_opus.additional_properties = d 124 return whip_audio_encoder_options_opus
5class WhipAudioEncoderOptionsOpusType(str, Enum): 6 """None""" 7 8 OPUS = "opus" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
15@_attrs_define 16class WhipInput: 17 """ 18 Attributes: 19 type_ (WhipInputType): 20 bearer_token (None | str | Unset): Token used for authentication in WHIP protocol. If not provided, the random 21 value 22 will be generated and returned in the response. 23 video (bool | None | Unset): If `true`, accepts a h264-encoded video track. 24 If not provided, it defaults to `true` 25 """ 26 27 type_: WhipInputType 28 bearer_token: None | str | Unset = UNSET 29 video: bool | None | Unset = UNSET 30 31 def to_dict(self) -> dict[str, Any]: 32 type_ = self.type_.value 33 34 bearer_token: None | str | Unset 35 if isinstance(self.bearer_token, Unset): 36 bearer_token = UNSET 37 else: 38 bearer_token = self.bearer_token 39 40 video: bool | None | Unset 41 if isinstance(self.video, Unset): 42 video = UNSET 43 else: 44 video = self.video 45 46 field_dict: dict[str, Any] = {} 47 48 field_dict.update({ 49 "type": type_, 50 }) 51 if bearer_token is not UNSET: 52 field_dict["bearer_token"] = bearer_token 53 if video is not UNSET: 54 field_dict["video"] = video 55 56 return field_dict 57 58 @classmethod 59 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 60 d = dict(src_dict) 61 type_ = WhipInputType(d.pop("type")) 62 63 def _parse_bearer_token(data: object) -> None | str | Unset: 64 if data is None: 65 return data 66 if isinstance(data, Unset): 67 return data 68 return cast(None | str | Unset, data) 69 70 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 71 72 def _parse_video(data: object) -> bool | None | Unset: 73 if data is None: 74 return data 75 if isinstance(data, Unset): 76 return data 77 return cast(bool | None | Unset, data) 78 79 video = _parse_video(d.pop("video", UNSET)) 80 81 whip_input = cls( 82 type_=type_, 83 bearer_token=bearer_token, 84 video=video, 85 ) 86 87 return whip_input
Attributes:
- type_ (WhipInputType):
- bearer_token (None | str | Unset): Token used for authentication in WHIP protocol. If not provided, the random value will be generated and returned in the response.
- video (bool | None | Unset): If
true, accepts a h264-encoded video track. If not provided, it defaults totrue
25def __init__(self, type_, bearer_token=attr_dict['bearer_token'].default, video=attr_dict['video'].default): 26 self.type_ = type_ 27 self.bearer_token = bearer_token 28 self.video = video
Method generated by attrs for class WhipInput.
31 def to_dict(self) -> dict[str, Any]: 32 type_ = self.type_.value 33 34 bearer_token: None | str | Unset 35 if isinstance(self.bearer_token, Unset): 36 bearer_token = UNSET 37 else: 38 bearer_token = self.bearer_token 39 40 video: bool | None | Unset 41 if isinstance(self.video, Unset): 42 video = UNSET 43 else: 44 video = self.video 45 46 field_dict: dict[str, Any] = {} 47 48 field_dict.update({ 49 "type": type_, 50 }) 51 if bearer_token is not UNSET: 52 field_dict["bearer_token"] = bearer_token 53 if video is not UNSET: 54 field_dict["video"] = video 55 56 return field_dict
58 @classmethod 59 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 60 d = dict(src_dict) 61 type_ = WhipInputType(d.pop("type")) 62 63 def _parse_bearer_token(data: object) -> None | str | Unset: 64 if data is None: 65 return data 66 if isinstance(data, Unset): 67 return data 68 return cast(None | str | Unset, data) 69 70 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 71 72 def _parse_video(data: object) -> bool | None | Unset: 73 if data is None: 74 return data 75 if isinstance(data, Unset): 76 return data 77 return cast(bool | None | Unset, data) 78 79 video = _parse_video(d.pop("video", UNSET)) 80 81 whip_input = cls( 82 type_=type_, 83 bearer_token=bearer_token, 84 video=video, 85 ) 86 87 return whip_input
5class WhipInputType(str, Enum): 6 """None""" 7 8 WHIP_SERVER = "whip_server" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
20@_attrs_define 21class WhipOutput: 22 """ 23 Attributes: 24 endpoint_url (str): WHIP server endpoint 25 type_ (WhipOutputType): 26 bearer_token (None | str | Unset): 27 video (None | OutputWhipVideoOptions | Unset): 28 audio (None | OutputWhipAudioOptions | Unset): 29 """ 30 31 endpoint_url: str 32 type_: WhipOutputType 33 bearer_token: None | str | Unset = UNSET 34 video: None | OutputWhipVideoOptions | Unset = UNSET 35 audio: None | OutputWhipAudioOptions | Unset = UNSET 36 37 def to_dict(self) -> dict[str, Any]: 38 from ..models.output_whip_audio_options import OutputWhipAudioOptions 39 from ..models.output_whip_video_options import OutputWhipVideoOptions 40 41 endpoint_url = self.endpoint_url 42 43 type_ = self.type_.value 44 45 bearer_token: None | str | Unset 46 if isinstance(self.bearer_token, Unset): 47 bearer_token = UNSET 48 else: 49 bearer_token = self.bearer_token 50 51 video: dict[str, Any] | None | Unset 52 if isinstance(self.video, Unset): 53 video = UNSET 54 elif isinstance(self.video, OutputWhipVideoOptions): 55 video = self.video.to_dict() 56 else: 57 video = self.video 58 59 audio: dict[str, Any] | None | Unset 60 if isinstance(self.audio, Unset): 61 audio = UNSET 62 elif isinstance(self.audio, OutputWhipAudioOptions): 63 audio = self.audio.to_dict() 64 else: 65 audio = self.audio 66 67 field_dict: dict[str, Any] = {} 68 69 field_dict.update({ 70 "endpoint_url": endpoint_url, 71 "type": type_, 72 }) 73 if bearer_token is not UNSET: 74 field_dict["bearer_token"] = bearer_token 75 if video is not UNSET: 76 field_dict["video"] = video 77 if audio is not UNSET: 78 field_dict["audio"] = audio 79 80 return field_dict 81 82 @classmethod 83 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 84 from ..models.output_whip_audio_options import OutputWhipAudioOptions 85 from ..models.output_whip_video_options import OutputWhipVideoOptions 86 87 d = dict(src_dict) 88 endpoint_url = d.pop("endpoint_url") 89 90 type_ = WhipOutputType(d.pop("type")) 91 92 def _parse_bearer_token(data: object) -> None | str | Unset: 93 if data is None: 94 return data 95 if isinstance(data, Unset): 96 return data 97 return cast(None | str | Unset, data) 98 99 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 100 101 def _parse_video(data: object) -> None | OutputWhipVideoOptions | Unset: 102 if data is None: 103 return data 104 if isinstance(data, Unset): 105 return data 106 try: 107 if not isinstance(data, dict): 108 raise TypeError() 109 video_type_1 = OutputWhipVideoOptions.from_dict(data) 110 111 return video_type_1 112 except (TypeError, ValueError, AttributeError, KeyError): 113 pass 114 return cast(None | OutputWhipVideoOptions | Unset, data) 115 116 video = _parse_video(d.pop("video", UNSET)) 117 118 def _parse_audio(data: object) -> None | OutputWhipAudioOptions | Unset: 119 if data is None: 120 return data 121 if isinstance(data, Unset): 122 return data 123 try: 124 if not isinstance(data, dict): 125 raise TypeError() 126 audio_type_1 = OutputWhipAudioOptions.from_dict(data) 127 128 return audio_type_1 129 except (TypeError, ValueError, AttributeError, KeyError): 130 pass 131 return cast(None | OutputWhipAudioOptions | Unset, data) 132 133 audio = _parse_audio(d.pop("audio", UNSET)) 134 135 whip_output = cls( 136 endpoint_url=endpoint_url, 137 type_=type_, 138 bearer_token=bearer_token, 139 video=video, 140 audio=audio, 141 ) 142 143 return whip_output
Attributes:
- endpoint_url (str): WHIP server endpoint
- type_ (WhipOutputType):
- bearer_token (None | str | Unset):
- video (None | OutputWhipVideoOptions | Unset):
- audio (None | OutputWhipAudioOptions | Unset):
27def __init__(self, endpoint_url, type_, bearer_token=attr_dict['bearer_token'].default, video=attr_dict['video'].default, audio=attr_dict['audio'].default): 28 self.endpoint_url = endpoint_url 29 self.type_ = type_ 30 self.bearer_token = bearer_token 31 self.video = video 32 self.audio = audio
Method generated by attrs for class WhipOutput.
37 def to_dict(self) -> dict[str, Any]: 38 from ..models.output_whip_audio_options import OutputWhipAudioOptions 39 from ..models.output_whip_video_options import OutputWhipVideoOptions 40 41 endpoint_url = self.endpoint_url 42 43 type_ = self.type_.value 44 45 bearer_token: None | str | Unset 46 if isinstance(self.bearer_token, Unset): 47 bearer_token = UNSET 48 else: 49 bearer_token = self.bearer_token 50 51 video: dict[str, Any] | None | Unset 52 if isinstance(self.video, Unset): 53 video = UNSET 54 elif isinstance(self.video, OutputWhipVideoOptions): 55 video = self.video.to_dict() 56 else: 57 video = self.video 58 59 audio: dict[str, Any] | None | Unset 60 if isinstance(self.audio, Unset): 61 audio = UNSET 62 elif isinstance(self.audio, OutputWhipAudioOptions): 63 audio = self.audio.to_dict() 64 else: 65 audio = self.audio 66 67 field_dict: dict[str, Any] = {} 68 69 field_dict.update({ 70 "endpoint_url": endpoint_url, 71 "type": type_, 72 }) 73 if bearer_token is not UNSET: 74 field_dict["bearer_token"] = bearer_token 75 if video is not UNSET: 76 field_dict["video"] = video 77 if audio is not UNSET: 78 field_dict["audio"] = audio 79 80 return field_dict
82 @classmethod 83 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 84 from ..models.output_whip_audio_options import OutputWhipAudioOptions 85 from ..models.output_whip_video_options import OutputWhipVideoOptions 86 87 d = dict(src_dict) 88 endpoint_url = d.pop("endpoint_url") 89 90 type_ = WhipOutputType(d.pop("type")) 91 92 def _parse_bearer_token(data: object) -> None | str | Unset: 93 if data is None: 94 return data 95 if isinstance(data, Unset): 96 return data 97 return cast(None | str | Unset, data) 98 99 bearer_token = _parse_bearer_token(d.pop("bearer_token", UNSET)) 100 101 def _parse_video(data: object) -> None | OutputWhipVideoOptions | Unset: 102 if data is None: 103 return data 104 if isinstance(data, Unset): 105 return data 106 try: 107 if not isinstance(data, dict): 108 raise TypeError() 109 video_type_1 = OutputWhipVideoOptions.from_dict(data) 110 111 return video_type_1 112 except (TypeError, ValueError, AttributeError, KeyError): 113 pass 114 return cast(None | OutputWhipVideoOptions | Unset, data) 115 116 video = _parse_video(d.pop("video", UNSET)) 117 118 def _parse_audio(data: object) -> None | OutputWhipAudioOptions | Unset: 119 if data is None: 120 return data 121 if isinstance(data, Unset): 122 return data 123 try: 124 if not isinstance(data, dict): 125 raise TypeError() 126 audio_type_1 = OutputWhipAudioOptions.from_dict(data) 127 128 return audio_type_1 129 except (TypeError, ValueError, AttributeError, KeyError): 130 pass 131 return cast(None | OutputWhipAudioOptions | Unset, data) 132 133 audio = _parse_audio(d.pop("audio", UNSET)) 134 135 whip_output = cls( 136 endpoint_url=endpoint_url, 137 type_=type_, 138 bearer_token=bearer_token, 139 video=video, 140 audio=audio, 141 ) 142 143 return whip_output
5class WhipOutputType(str, Enum): 6 """None""" 7 8 WHIP_CLIENT = "whip_client" 9 10 def __str__(self) -> str: 11 return str(self.value)
None
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans