miro_api.models.update_text_style
Miro Developer Platform
### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? Read our introduction page and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - Quickstart (video): try the REST API in less than 3 minutes. - Quickstart (article): get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - Get started with OAuth 2.0 and Miro ### Miro App Examples Clone our Miro App Examples repository to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0.
The version of the OpenAPI document: v2.0 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4Miro Developer Platform 5 6<img src=\"https://content.pstmn.io/47449ea6-0ef7-4af2-bac1-e58a70e61c58/aW1hZ2UucG5n\" width=\"1685\" height=\"593\"> ### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? [Read our introduction page](https://beta.developers.miro.com/docs/introduction) and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - [Quickstart (video):](https://beta.developers.miro.com/docs/try-out-the-rest-api-in-less-than-3-minutes) try the REST API in less than 3 minutes. - [Quickstart (article):](https://beta.developers.miro.com/docs/build-your-first-hello-world-app-1) get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - [Get started with OAuth 2.0 and Miro](https://beta.developers.miro.com/docs/getting-started-with-oauth) ### Miro App Examples Clone our [Miro App Examples repository](https://github.com/miroapp/app-examples) to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0. 7 8The version of the OpenAPI document: v2.0 9Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11Do not edit the class manually. 12""" # noqa: E501 13 14from __future__ import annotations 15import pprint 16import re # noqa: F401 17import json 18 19from pydantic import BaseModel, Field, StrictStr, field_validator 20from typing import Any, ClassVar, Dict, List, Optional 21from typing_extensions import Annotated 22from typing import Optional, Set 23from typing_extensions import Self 24 25 26class UpdateTextStyle(BaseModel): 27 """ 28 Contains information about the style of a text item, such as the fill color or font family. 29 """ # noqa: E501 30 31 color: Optional[StrictStr] = Field( 32 default=None, description="Hex value representing the color for the text within the text item." 33 ) 34 fill_color: Optional[StrictStr] = Field( 35 default=None, description="Background color of the text item.", alias="fillColor" 36 ) 37 fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field( 38 default=None, 39 description="Opacity level of the background color. Possible values: any number between `0.0` and `1.0`, where: `0.0`: the background color is completely transparent or invisible `1.0`: the background color is completely opaque or solid", 40 alias="fillOpacity", 41 ) 42 font_family: Optional[StrictStr] = Field( 43 default=None, description="Font type for the text in the text item.", alias="fontFamily" 44 ) 45 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 46 default=None, description="Font size, in dp.", alias="fontSize" 47 ) 48 text_align: Optional[StrictStr] = Field( 49 default=None, description="Horizontal alignment for the item's content.", alias="textAlign" 50 ) 51 additional_properties: Dict[str, Any] = {} 52 __properties: ClassVar[List[str]] = ["color", "fillColor", "fillOpacity", "fontFamily", "fontSize", "textAlign"] 53 54 @field_validator("font_family") 55 def font_family_validate_enum(cls, value): 56 """Validates the enum""" 57 if value is None: 58 return value 59 60 if value not in set( 61 [ 62 "arial", 63 "abril_fatface", 64 "bangers", 65 "eb_garamond", 66 "georgia", 67 "graduate", 68 "gravitas_one", 69 "fredoka_one", 70 "nixie_one", 71 "open_sans", 72 "permanent_marker", 73 "pt_sans", 74 "pt_sans_narrow", 75 "pt_serif", 76 "rammetto_one", 77 "roboto", 78 "roboto_condensed", 79 "roboto_slab", 80 "caveat", 81 "times_new_roman", 82 "titan_one", 83 "lemon_tuesday", 84 "roboto_mono", 85 "noto_sans", 86 "plex_sans", 87 "plex_serif", 88 "plex_mono", 89 "spoof", 90 "tiempos_text", 91 "formular", 92 ] 93 ): 94 raise ValueError( 95 "must be one of enum values ('arial', 'abril_fatface', 'bangers', 'eb_garamond', 'georgia', 'graduate', 'gravitas_one', 'fredoka_one', 'nixie_one', 'open_sans', 'permanent_marker', 'pt_sans', 'pt_sans_narrow', 'pt_serif', 'rammetto_one', 'roboto', 'roboto_condensed', 'roboto_slab', 'caveat', 'times_new_roman', 'titan_one', 'lemon_tuesday', 'roboto_mono', 'noto_sans', 'plex_sans', 'plex_serif', 'plex_mono', 'spoof', 'tiempos_text', 'formular')" 96 ) 97 return value 98 99 @field_validator("text_align") 100 def text_align_validate_enum(cls, value): 101 """Validates the enum""" 102 if value is None: 103 return value 104 105 if value not in set(["left", "right", "center"]): 106 raise ValueError("must be one of enum values ('left', 'right', 'center')") 107 return value 108 109 model_config = { 110 "populate_by_name": True, 111 "validate_assignment": True, 112 "protected_namespaces": (), 113 } 114 115 def to_str(self) -> str: 116 """Returns the string representation of the model using alias""" 117 return pprint.pformat(self.model_dump(by_alias=True)) 118 119 def to_json(self) -> str: 120 """Returns the JSON representation of the model using alias""" 121 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 122 return json.dumps(self.to_dict()) 123 124 @classmethod 125 def from_json(cls, json_str: str) -> Optional[Self]: 126 """Create an instance of UpdateTextStyle from a JSON string""" 127 return cls.from_dict(json.loads(json_str)) 128 129 def to_dict(self) -> Dict[str, Any]: 130 """Return the dictionary representation of the model using alias. 131 132 This has the following differences from calling pydantic's 133 `self.model_dump(by_alias=True)`: 134 135 * `None` is only added to the output dict for nullable fields that 136 were set at model initialization. Other fields with value `None` 137 are ignored. 138 * Fields in `self.additional_properties` are added to the output dict. 139 """ 140 excluded_fields: Set[str] = set( 141 [ 142 "additional_properties", 143 ] 144 ) 145 146 _dict = self.model_dump( 147 by_alias=True, 148 exclude=excluded_fields, 149 exclude_none=True, 150 ) 151 # puts key-value pairs in additional_properties in the top level 152 if self.additional_properties is not None: 153 for _key, _value in self.additional_properties.items(): 154 _dict[_key] = _value 155 156 return _dict 157 158 @classmethod 159 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 160 """Create an instance of UpdateTextStyle from a dict""" 161 if obj is None: 162 return None 163 164 if not isinstance(obj, dict): 165 return cls.model_validate(obj) 166 167 _obj = cls.model_validate( 168 { 169 "color": obj.get("color"), 170 "fillColor": obj.get("fillColor"), 171 "fillOpacity": obj.get("fillOpacity"), 172 "fontFamily": obj.get("fontFamily"), 173 "fontSize": obj.get("fontSize"), 174 "textAlign": obj.get("textAlign"), 175 } 176 ) 177 # store additional fields in additional_properties 178 for _key in obj.keys(): 179 if _key not in cls.__properties: 180 _obj.additional_properties[_key] = obj.get(_key) 181 182 return _obj
27class UpdateTextStyle(BaseModel): 28 """ 29 Contains information about the style of a text item, such as the fill color or font family. 30 """ # noqa: E501 31 32 color: Optional[StrictStr] = Field( 33 default=None, description="Hex value representing the color for the text within the text item." 34 ) 35 fill_color: Optional[StrictStr] = Field( 36 default=None, description="Background color of the text item.", alias="fillColor" 37 ) 38 fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field( 39 default=None, 40 description="Opacity level of the background color. Possible values: any number between `0.0` and `1.0`, where: `0.0`: the background color is completely transparent or invisible `1.0`: the background color is completely opaque or solid", 41 alias="fillOpacity", 42 ) 43 font_family: Optional[StrictStr] = Field( 44 default=None, description="Font type for the text in the text item.", alias="fontFamily" 45 ) 46 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 47 default=None, description="Font size, in dp.", alias="fontSize" 48 ) 49 text_align: Optional[StrictStr] = Field( 50 default=None, description="Horizontal alignment for the item's content.", alias="textAlign" 51 ) 52 additional_properties: Dict[str, Any] = {} 53 __properties: ClassVar[List[str]] = ["color", "fillColor", "fillOpacity", "fontFamily", "fontSize", "textAlign"] 54 55 @field_validator("font_family") 56 def font_family_validate_enum(cls, value): 57 """Validates the enum""" 58 if value is None: 59 return value 60 61 if value not in set( 62 [ 63 "arial", 64 "abril_fatface", 65 "bangers", 66 "eb_garamond", 67 "georgia", 68 "graduate", 69 "gravitas_one", 70 "fredoka_one", 71 "nixie_one", 72 "open_sans", 73 "permanent_marker", 74 "pt_sans", 75 "pt_sans_narrow", 76 "pt_serif", 77 "rammetto_one", 78 "roboto", 79 "roboto_condensed", 80 "roboto_slab", 81 "caveat", 82 "times_new_roman", 83 "titan_one", 84 "lemon_tuesday", 85 "roboto_mono", 86 "noto_sans", 87 "plex_sans", 88 "plex_serif", 89 "plex_mono", 90 "spoof", 91 "tiempos_text", 92 "formular", 93 ] 94 ): 95 raise ValueError( 96 "must be one of enum values ('arial', 'abril_fatface', 'bangers', 'eb_garamond', 'georgia', 'graduate', 'gravitas_one', 'fredoka_one', 'nixie_one', 'open_sans', 'permanent_marker', 'pt_sans', 'pt_sans_narrow', 'pt_serif', 'rammetto_one', 'roboto', 'roboto_condensed', 'roboto_slab', 'caveat', 'times_new_roman', 'titan_one', 'lemon_tuesday', 'roboto_mono', 'noto_sans', 'plex_sans', 'plex_serif', 'plex_mono', 'spoof', 'tiempos_text', 'formular')" 97 ) 98 return value 99 100 @field_validator("text_align") 101 def text_align_validate_enum(cls, value): 102 """Validates the enum""" 103 if value is None: 104 return value 105 106 if value not in set(["left", "right", "center"]): 107 raise ValueError("must be one of enum values ('left', 'right', 'center')") 108 return value 109 110 model_config = { 111 "populate_by_name": True, 112 "validate_assignment": True, 113 "protected_namespaces": (), 114 } 115 116 def to_str(self) -> str: 117 """Returns the string representation of the model using alias""" 118 return pprint.pformat(self.model_dump(by_alias=True)) 119 120 def to_json(self) -> str: 121 """Returns the JSON representation of the model using alias""" 122 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 123 return json.dumps(self.to_dict()) 124 125 @classmethod 126 def from_json(cls, json_str: str) -> Optional[Self]: 127 """Create an instance of UpdateTextStyle from a JSON string""" 128 return cls.from_dict(json.loads(json_str)) 129 130 def to_dict(self) -> Dict[str, Any]: 131 """Return the dictionary representation of the model using alias. 132 133 This has the following differences from calling pydantic's 134 `self.model_dump(by_alias=True)`: 135 136 * `None` is only added to the output dict for nullable fields that 137 were set at model initialization. Other fields with value `None` 138 are ignored. 139 * Fields in `self.additional_properties` are added to the output dict. 140 """ 141 excluded_fields: Set[str] = set( 142 [ 143 "additional_properties", 144 ] 145 ) 146 147 _dict = self.model_dump( 148 by_alias=True, 149 exclude=excluded_fields, 150 exclude_none=True, 151 ) 152 # puts key-value pairs in additional_properties in the top level 153 if self.additional_properties is not None: 154 for _key, _value in self.additional_properties.items(): 155 _dict[_key] = _value 156 157 return _dict 158 159 @classmethod 160 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 161 """Create an instance of UpdateTextStyle from a dict""" 162 if obj is None: 163 return None 164 165 if not isinstance(obj, dict): 166 return cls.model_validate(obj) 167 168 _obj = cls.model_validate( 169 { 170 "color": obj.get("color"), 171 "fillColor": obj.get("fillColor"), 172 "fillOpacity": obj.get("fillOpacity"), 173 "fontFamily": obj.get("fontFamily"), 174 "fontSize": obj.get("fontSize"), 175 "textAlign": obj.get("textAlign"), 176 } 177 ) 178 # store additional fields in additional_properties 179 for _key in obj.keys(): 180 if _key not in cls.__properties: 181 _obj.additional_properties[_key] = obj.get(_key) 182 183 return _obj
Contains information about the style of a text item, such as the fill color or font family.
55 @field_validator("font_family") 56 def font_family_validate_enum(cls, value): 57 """Validates the enum""" 58 if value is None: 59 return value 60 61 if value not in set( 62 [ 63 "arial", 64 "abril_fatface", 65 "bangers", 66 "eb_garamond", 67 "georgia", 68 "graduate", 69 "gravitas_one", 70 "fredoka_one", 71 "nixie_one", 72 "open_sans", 73 "permanent_marker", 74 "pt_sans", 75 "pt_sans_narrow", 76 "pt_serif", 77 "rammetto_one", 78 "roboto", 79 "roboto_condensed", 80 "roboto_slab", 81 "caveat", 82 "times_new_roman", 83 "titan_one", 84 "lemon_tuesday", 85 "roboto_mono", 86 "noto_sans", 87 "plex_sans", 88 "plex_serif", 89 "plex_mono", 90 "spoof", 91 "tiempos_text", 92 "formular", 93 ] 94 ): 95 raise ValueError( 96 "must be one of enum values ('arial', 'abril_fatface', 'bangers', 'eb_garamond', 'georgia', 'graduate', 'gravitas_one', 'fredoka_one', 'nixie_one', 'open_sans', 'permanent_marker', 'pt_sans', 'pt_sans_narrow', 'pt_serif', 'rammetto_one', 'roboto', 'roboto_condensed', 'roboto_slab', 'caveat', 'times_new_roman', 'titan_one', 'lemon_tuesday', 'roboto_mono', 'noto_sans', 'plex_sans', 'plex_serif', 'plex_mono', 'spoof', 'tiempos_text', 'formular')" 97 ) 98 return value
Validates the enum
100 @field_validator("text_align") 101 def text_align_validate_enum(cls, value): 102 """Validates the enum""" 103 if value is None: 104 return value 105 106 if value not in set(["left", "right", "center"]): 107 raise ValueError("must be one of enum values ('left', 'right', 'center')") 108 return value
Validates the enum
116 def to_str(self) -> str: 117 """Returns the string representation of the model using alias""" 118 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
120 def to_json(self) -> str: 121 """Returns the JSON representation of the model using alias""" 122 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 123 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
125 @classmethod 126 def from_json(cls, json_str: str) -> Optional[Self]: 127 """Create an instance of UpdateTextStyle from a JSON string""" 128 return cls.from_dict(json.loads(json_str))
Create an instance of UpdateTextStyle from a JSON string
130 def to_dict(self) -> Dict[str, Any]: 131 """Return the dictionary representation of the model using alias. 132 133 This has the following differences from calling pydantic's 134 `self.model_dump(by_alias=True)`: 135 136 * `None` is only added to the output dict for nullable fields that 137 were set at model initialization. Other fields with value `None` 138 are ignored. 139 * Fields in `self.additional_properties` are added to the output dict. 140 """ 141 excluded_fields: Set[str] = set( 142 [ 143 "additional_properties", 144 ] 145 ) 146 147 _dict = self.model_dump( 148 by_alias=True, 149 exclude=excluded_fields, 150 exclude_none=True, 151 ) 152 # puts key-value pairs in additional_properties in the top level 153 if self.additional_properties is not None: 154 for _key, _value in self.additional_properties.items(): 155 _dict[_key] = _value 156 157 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
159 @classmethod 160 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 161 """Create an instance of UpdateTextStyle from a dict""" 162 if obj is None: 163 return None 164 165 if not isinstance(obj, dict): 166 return cls.model_validate(obj) 167 168 _obj = cls.model_validate( 169 { 170 "color": obj.get("color"), 171 "fillColor": obj.get("fillColor"), 172 "fillOpacity": obj.get("fillOpacity"), 173 "fontFamily": obj.get("fontFamily"), 174 "fontSize": obj.get("fontSize"), 175 "textAlign": obj.get("textAlign"), 176 } 177 ) 178 # store additional fields in additional_properties 179 for _key in obj.keys(): 180 if _key not in cls.__properties: 181 _obj.additional_properties[_key] = obj.get(_key) 182 183 return _obj
Create an instance of UpdateTextStyle from a dict
265def init_private_attributes(self: BaseModel, __context: Any) -> None: 266 """This function is meant to behave like a BaseModel method to initialise private attributes. 267 268 It takes context as an argument since that's what pydantic-core passes when calling it. 269 270 Args: 271 self: The BaseModel instance. 272 __context: The context. 273 """ 274 if getattr(self, '__pydantic_private__', None) is None: 275 pydantic_private = {} 276 for name, private_attr in self.__private_attributes__.items(): 277 default = private_attr.get_default() 278 if default is not PydanticUndefined: 279 pydantic_private[name] = default 280 object_setattr(self, '__pydantic_private__', pydantic_private)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that's what pydantic-core passes when calling it.
Args: self: The BaseModel instance. __context: The context.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs