miro_api.models.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 14 15from __future__ import annotations 16import pprint 17import re # noqa: F401 18import json 19 20from pydantic import BaseModel, Field, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List, Optional 22from typing_extensions import Annotated 23from typing import Optional, Set 24from typing_extensions import Self 25 26 27class TextStyle(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, 34 description="Hex value representing the color for the text within the text item. Default: `#1a1a1a`.", 35 ) 36 fill_color: Optional[StrictStr] = Field( 37 default=None, description="Background color of the text item. Default: `#ffffff`.", alias="fillColor" 38 ) 39 fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field( 40 default=None, 41 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. Default: `1.0` if `fillColor` is provided, `0.0` if `fillColor` is not provided.", 42 alias="fillOpacity", 43 ) 44 font_family: Optional[StrictStr] = Field( 45 default=None, description="Font type for the text in the text item. Default: `arial`.", alias="fontFamily" 46 ) 47 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 48 default=None, description="Font size, in dp. Default: `14`.", alias="fontSize" 49 ) 50 text_align: Optional[StrictStr] = Field( 51 default=None, description="Horizontal alignment for the item's content. Default: `center.`", alias="textAlign" 52 ) 53 additional_properties: Dict[str, Any] = {} 54 __properties: ClassVar[List[str]] = ["color", "fillColor", "fillOpacity", "fontFamily", "fontSize", "textAlign"] 55 56 @field_validator("font_family") 57 def font_family_validate_enum(cls, value): 58 """Validates the enum""" 59 if value is None: 60 return value 61 62 if value not in set( 63 [ 64 "arial", 65 "abril_fatface", 66 "bangers", 67 "eb_garamond", 68 "georgia", 69 "graduate", 70 "gravitas_one", 71 "fredoka_one", 72 "nixie_one", 73 "open_sans", 74 "permanent_marker", 75 "pt_sans", 76 "pt_sans_narrow", 77 "pt_serif", 78 "rammetto_one", 79 "roboto", 80 "roboto_condensed", 81 "roboto_slab", 82 "caveat", 83 "times_new_roman", 84 "titan_one", 85 "lemon_tuesday", 86 "roboto_mono", 87 "noto_sans", 88 "plex_sans", 89 "plex_serif", 90 "plex_mono", 91 "spoof", 92 "tiempos_text", 93 "formular", 94 ] 95 ): 96 raise ValueError( 97 "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')" 98 ) 99 return value 100 101 @field_validator("text_align") 102 def text_align_validate_enum(cls, value): 103 """Validates the enum""" 104 if value is None: 105 return value 106 107 if value not in set(["left", "right", "center"]): 108 raise ValueError("must be one of enum values ('left', 'right', 'center')") 109 return value 110 111 model_config = { 112 "populate_by_name": True, 113 "validate_assignment": True, 114 "protected_namespaces": (), 115 } 116 117 def to_str(self) -> str: 118 """Returns the string representation of the model using alias""" 119 return pprint.pformat(self.model_dump(by_alias=True)) 120 121 def to_json(self) -> str: 122 """Returns the JSON representation of the model using alias""" 123 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 124 return json.dumps(self.to_dict()) 125 126 @classmethod 127 def from_json(cls, json_str: str) -> Optional[Self]: 128 """Create an instance of TextStyle from a JSON string""" 129 return cls.from_dict(json.loads(json_str)) 130 131 def to_dict(self) -> Dict[str, Any]: 132 """Return the dictionary representation of the model using alias. 133 134 This has the following differences from calling pydantic's 135 `self.model_dump(by_alias=True)`: 136 137 * `None` is only added to the output dict for nullable fields that 138 were set at model initialization. Other fields with value `None` 139 are ignored. 140 * Fields in `self.additional_properties` are added to the output dict. 141 """ 142 excluded_fields: Set[str] = set( 143 [ 144 "additional_properties", 145 ] 146 ) 147 148 _dict = self.model_dump( 149 by_alias=True, 150 exclude=excluded_fields, 151 exclude_none=True, 152 ) 153 # puts key-value pairs in additional_properties in the top level 154 if self.additional_properties is not None: 155 for _key, _value in self.additional_properties.items(): 156 _dict[_key] = _value 157 158 return _dict 159 160 @classmethod 161 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 162 """Create an instance of TextStyle from a dict""" 163 if obj is None: 164 return None 165 166 if not isinstance(obj, dict): 167 return cls.model_validate(obj) 168 169 _obj = cls.model_validate( 170 { 171 "color": obj.get("color"), 172 "fillColor": obj.get("fillColor"), 173 "fillOpacity": obj.get("fillOpacity"), 174 "fontFamily": obj.get("fontFamily"), 175 "fontSize": obj.get("fontSize"), 176 "textAlign": obj.get("textAlign"), 177 } 178 ) 179 # store additional fields in additional_properties 180 for _key in obj.keys(): 181 if _key not in cls.__properties: 182 _obj.additional_properties[_key] = obj.get(_key) 183 184 return _obj
28class TextStyle(BaseModel): 29 """ 30 Contains information about the style of a text item, such as the fill color or font family. 31 """ # noqa: E501 32 33 color: Optional[StrictStr] = Field( 34 default=None, 35 description="Hex value representing the color for the text within the text item. Default: `#1a1a1a`.", 36 ) 37 fill_color: Optional[StrictStr] = Field( 38 default=None, description="Background color of the text item. Default: `#ffffff`.", alias="fillColor" 39 ) 40 fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field( 41 default=None, 42 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. Default: `1.0` if `fillColor` is provided, `0.0` if `fillColor` is not provided.", 43 alias="fillOpacity", 44 ) 45 font_family: Optional[StrictStr] = Field( 46 default=None, description="Font type for the text in the text item. Default: `arial`.", alias="fontFamily" 47 ) 48 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 49 default=None, description="Font size, in dp. Default: `14`.", alias="fontSize" 50 ) 51 text_align: Optional[StrictStr] = Field( 52 default=None, description="Horizontal alignment for the item's content. Default: `center.`", alias="textAlign" 53 ) 54 additional_properties: Dict[str, Any] = {} 55 __properties: ClassVar[List[str]] = ["color", "fillColor", "fillOpacity", "fontFamily", "fontSize", "textAlign"] 56 57 @field_validator("font_family") 58 def font_family_validate_enum(cls, value): 59 """Validates the enum""" 60 if value is None: 61 return value 62 63 if value not in set( 64 [ 65 "arial", 66 "abril_fatface", 67 "bangers", 68 "eb_garamond", 69 "georgia", 70 "graduate", 71 "gravitas_one", 72 "fredoka_one", 73 "nixie_one", 74 "open_sans", 75 "permanent_marker", 76 "pt_sans", 77 "pt_sans_narrow", 78 "pt_serif", 79 "rammetto_one", 80 "roboto", 81 "roboto_condensed", 82 "roboto_slab", 83 "caveat", 84 "times_new_roman", 85 "titan_one", 86 "lemon_tuesday", 87 "roboto_mono", 88 "noto_sans", 89 "plex_sans", 90 "plex_serif", 91 "plex_mono", 92 "spoof", 93 "tiempos_text", 94 "formular", 95 ] 96 ): 97 raise ValueError( 98 "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')" 99 ) 100 return value 101 102 @field_validator("text_align") 103 def text_align_validate_enum(cls, value): 104 """Validates the enum""" 105 if value is None: 106 return value 107 108 if value not in set(["left", "right", "center"]): 109 raise ValueError("must be one of enum values ('left', 'right', 'center')") 110 return value 111 112 model_config = { 113 "populate_by_name": True, 114 "validate_assignment": True, 115 "protected_namespaces": (), 116 } 117 118 def to_str(self) -> str: 119 """Returns the string representation of the model using alias""" 120 return pprint.pformat(self.model_dump(by_alias=True)) 121 122 def to_json(self) -> str: 123 """Returns the JSON representation of the model using alias""" 124 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 125 return json.dumps(self.to_dict()) 126 127 @classmethod 128 def from_json(cls, json_str: str) -> Optional[Self]: 129 """Create an instance of TextStyle from a JSON string""" 130 return cls.from_dict(json.loads(json_str)) 131 132 def to_dict(self) -> Dict[str, Any]: 133 """Return the dictionary representation of the model using alias. 134 135 This has the following differences from calling pydantic's 136 `self.model_dump(by_alias=True)`: 137 138 * `None` is only added to the output dict for nullable fields that 139 were set at model initialization. Other fields with value `None` 140 are ignored. 141 * Fields in `self.additional_properties` are added to the output dict. 142 """ 143 excluded_fields: Set[str] = set( 144 [ 145 "additional_properties", 146 ] 147 ) 148 149 _dict = self.model_dump( 150 by_alias=True, 151 exclude=excluded_fields, 152 exclude_none=True, 153 ) 154 # puts key-value pairs in additional_properties in the top level 155 if self.additional_properties is not None: 156 for _key, _value in self.additional_properties.items(): 157 _dict[_key] = _value 158 159 return _dict 160 161 @classmethod 162 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 163 """Create an instance of TextStyle from a dict""" 164 if obj is None: 165 return None 166 167 if not isinstance(obj, dict): 168 return cls.model_validate(obj) 169 170 _obj = cls.model_validate( 171 { 172 "color": obj.get("color"), 173 "fillColor": obj.get("fillColor"), 174 "fillOpacity": obj.get("fillOpacity"), 175 "fontFamily": obj.get("fontFamily"), 176 "fontSize": obj.get("fontSize"), 177 "textAlign": obj.get("textAlign"), 178 } 179 ) 180 # store additional fields in additional_properties 181 for _key in obj.keys(): 182 if _key not in cls.__properties: 183 _obj.additional_properties[_key] = obj.get(_key) 184 185 return _obj
Contains information about the style of a text item, such as the fill color or font family.
57 @field_validator("font_family") 58 def font_family_validate_enum(cls, value): 59 """Validates the enum""" 60 if value is None: 61 return value 62 63 if value not in set( 64 [ 65 "arial", 66 "abril_fatface", 67 "bangers", 68 "eb_garamond", 69 "georgia", 70 "graduate", 71 "gravitas_one", 72 "fredoka_one", 73 "nixie_one", 74 "open_sans", 75 "permanent_marker", 76 "pt_sans", 77 "pt_sans_narrow", 78 "pt_serif", 79 "rammetto_one", 80 "roboto", 81 "roboto_condensed", 82 "roboto_slab", 83 "caveat", 84 "times_new_roman", 85 "titan_one", 86 "lemon_tuesday", 87 "roboto_mono", 88 "noto_sans", 89 "plex_sans", 90 "plex_serif", 91 "plex_mono", 92 "spoof", 93 "tiempos_text", 94 "formular", 95 ] 96 ): 97 raise ValueError( 98 "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')" 99 ) 100 return value
Validates the enum
102 @field_validator("text_align") 103 def text_align_validate_enum(cls, value): 104 """Validates the enum""" 105 if value is None: 106 return value 107 108 if value not in set(["left", "right", "center"]): 109 raise ValueError("must be one of enum values ('left', 'right', 'center')") 110 return value
Validates the enum
118 def to_str(self) -> str: 119 """Returns the string representation of the model using alias""" 120 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
122 def to_json(self) -> str: 123 """Returns the JSON representation of the model using alias""" 124 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 125 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
127 @classmethod 128 def from_json(cls, json_str: str) -> Optional[Self]: 129 """Create an instance of TextStyle from a JSON string""" 130 return cls.from_dict(json.loads(json_str))
Create an instance of TextStyle from a JSON string
132 def to_dict(self) -> Dict[str, Any]: 133 """Return the dictionary representation of the model using alias. 134 135 This has the following differences from calling pydantic's 136 `self.model_dump(by_alias=True)`: 137 138 * `None` is only added to the output dict for nullable fields that 139 were set at model initialization. Other fields with value `None` 140 are ignored. 141 * Fields in `self.additional_properties` are added to the output dict. 142 """ 143 excluded_fields: Set[str] = set( 144 [ 145 "additional_properties", 146 ] 147 ) 148 149 _dict = self.model_dump( 150 by_alias=True, 151 exclude=excluded_fields, 152 exclude_none=True, 153 ) 154 # puts key-value pairs in additional_properties in the top level 155 if self.additional_properties is not None: 156 for _key, _value in self.additional_properties.items(): 157 _dict[_key] = _value 158 159 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)
:
None
is only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNone
are ignored.- Fields in
self.additional_properties
are added to the output dict.
161 @classmethod 162 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 163 """Create an instance of TextStyle from a dict""" 164 if obj is None: 165 return None 166 167 if not isinstance(obj, dict): 168 return cls.model_validate(obj) 169 170 _obj = cls.model_validate( 171 { 172 "color": obj.get("color"), 173 "fillColor": obj.get("fillColor"), 174 "fillOpacity": obj.get("fillOpacity"), 175 "fontFamily": obj.get("fontFamily"), 176 "fontSize": obj.get("fontSize"), 177 "textAlign": obj.get("textAlign"), 178 } 179 ) 180 # store additional fields in additional_properties 181 for _key in obj.keys(): 182 if _key not in cls.__properties: 183 _obj.additional_properties[_key] = obj.get(_key) 184 185 return _obj
Create an instance of TextStyle 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