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
 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 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
class UpdateTextStyle(pydantic.main.BaseModel):
 28class UpdateTextStyle(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, description="Hex value representing the color for the text within the text item."
 35    )
 36    fill_color: Optional[StrictStr] = Field(
 37        default=None, description="Background color of the text item.", 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",
 42        alias="fillOpacity",
 43    )
 44    font_family: Optional[StrictStr] = Field(
 45        default=None, description="Font type for the text in the text item.", alias="fontFamily"
 46    )
 47    font_size: Optional[Annotated[str, Field(strict=True)]] = Field(
 48        default=None, description="Font size, in dp.", alias="fontSize"
 49    )
 50    text_align: Optional[StrictStr] = Field(
 51        default=None, description="Horizontal alignment for the item's content.", 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 UpdateTextStyle 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 UpdateTextStyle 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

Contains information about the style of a text item, such as the fill color or font family.

color: Optional[Annotated[str, Strict(strict=True)]]
fill_color: Optional[Annotated[str, Strict(strict=True)]]
fill_opacity: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]]
font_family: Optional[Annotated[str, Strict(strict=True)]]
font_size: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]]
text_align: Optional[Annotated[str, Strict(strict=True)]]
additional_properties: Dict[str, Any]
@field_validator('font_family')
def font_family_validate_enum(cls, value):
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

Validates the enum

@field_validator('text_align')
def text_align_validate_enum(cls, value):
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

Validates the enum

model_config = {'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': ()}
def to_str(self) -> str:
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))

Returns the string representation of the model using alias

def to_json(self) -> str:
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())

Returns the JSON representation of the model using alias

@classmethod
def from_json(cls, json_str: str) -> Optional[typing_extensions.Self]:
126    @classmethod
127    def from_json(cls, json_str: str) -> Optional[Self]:
128        """Create an instance of UpdateTextStyle from a JSON string"""
129        return cls.from_dict(json.loads(json_str))

Create an instance of UpdateTextStyle from a JSON string

def to_dict(self) -> Dict[str, Any]:
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

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 value None are ignored.
  • Fields in self.additional_properties are added to the output dict.
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[typing_extensions.Self]:
160    @classmethod
161    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
162        """Create an instance of UpdateTextStyle 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

Create an instance of UpdateTextStyle from a dict

def model_post_init(self: pydantic.main.BaseModel, __context: Any) -> None:
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.

model_fields = {'color': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, description='Hex value representing the color for the text within the text item.'), 'fill_color': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='fillColor', alias_priority=2, description='Background color of the text item.'), 'fill_opacity': FieldInfo(annotation=Union[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])], NoneType], required=False, alias='fillOpacity', alias_priority=2, 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'), 'font_family': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='fontFamily', alias_priority=2, description='Font type for the text in the text item.'), 'font_size': FieldInfo(annotation=Union[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])], NoneType], required=False, alias='fontSize', alias_priority=2, description='Font size, in dp.'), 'text_align': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='textAlign', alias_priority=2, description="Horizontal alignment for the item's content."), 'additional_properties': FieldInfo(annotation=Dict[str, Any], required=False, default={})}
model_computed_fields = {}
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