miro_api.models.update_shape_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 UpdateShapeStyle(BaseModel):
 27    """
 28    Contains information about the shape style, such as the border color or opacity.
 29    """  # noqa: E501
 30
 31    border_color: Optional[StrictStr] = Field(
 32        default=None, description="Defines the color of the border of the shape.", alias="borderColor"
 33    )
 34    border_opacity: Optional[Annotated[str, Field(strict=True)]] = Field(
 35        default=None,
 36        description="Defines the opacity level of the shape border. 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",
 37        alias="borderOpacity",
 38    )
 39    border_style: Optional[StrictStr] = Field(
 40        default=None, description="Defines the style used to represent the border of the shape.", alias="borderStyle"
 41    )
 42    border_width: Optional[Annotated[str, Field(strict=True)]] = Field(
 43        default=None, description="Defines the thickness of the shape border, in dp.", alias="borderWidth"
 44    )
 45    color: Optional[StrictStr] = Field(
 46        default=None, description="Hex value representing the color for the text within the shape item."
 47    )
 48    fill_color: Optional[StrictStr] = Field(
 49        default=None,
 50        description="Fill color for the shape. Hex values: `#f5f6f8` `#d5f692` `#d0e17a` `#93d275` `#67c6c0` `#23bfe7` `#a6ccf5` `#7b92ff` `#fff9b1` `#f5d128` `#ff9d48` `#f16c7f` `#ea94bb` `#ffcee0` `#b384bb` `#000000`",
 51        alias="fillColor",
 52    )
 53    fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field(
 54        default=None,
 55        description="Opacity level of the fill color. Possible values: any number between `0` and `1`, where: `0.0`: the background color is completely transparent or invisible `1.0`: the background color is completely opaque or solid ",
 56        alias="fillOpacity",
 57    )
 58    font_family: Optional[StrictStr] = Field(
 59        default=None, description="Defines the font type for the text in the shape item.", alias="fontFamily"
 60    )
 61    font_size: Optional[Annotated[str, Field(strict=True)]] = Field(
 62        default=None, description="Defines the font size, in dp, for the text on the shape.", alias="fontSize"
 63    )
 64    text_align: Optional[StrictStr] = Field(
 65        default=None, description="Defines how the sticky note text is horizontally aligned.", alias="textAlign"
 66    )
 67    text_align_vertical: Optional[StrictStr] = Field(
 68        default=None, description="Defines how the sticky note text is vertically aligned.", alias="textAlignVertical"
 69    )
 70    additional_properties: Dict[str, Any] = {}
 71    __properties: ClassVar[List[str]] = [
 72        "borderColor",
 73        "borderOpacity",
 74        "borderStyle",
 75        "borderWidth",
 76        "color",
 77        "fillColor",
 78        "fillOpacity",
 79        "fontFamily",
 80        "fontSize",
 81        "textAlign",
 82        "textAlignVertical",
 83    ]
 84
 85    @field_validator("border_style")
 86    def border_style_validate_enum(cls, value):
 87        """Validates the enum"""
 88        if value is None:
 89            return value
 90
 91        if value not in set(["normal", "dotted", "dashed"]):
 92            raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')")
 93        return value
 94
 95    @field_validator("font_family")
 96    def font_family_validate_enum(cls, value):
 97        """Validates the enum"""
 98        if value is None:
 99            return value
100
101        if value not in set(
102            [
103                "arial",
104                "abril_fatface",
105                "bangers",
106                "eb_garamond",
107                "georgia",
108                "graduate",
109                "gravitas_one",
110                "fredoka_one",
111                "nixie_one",
112                "open_sans",
113                "permanent_marker",
114                "pt_sans",
115                "pt_sans_narrow",
116                "pt_serif",
117                "rammetto_one",
118                "roboto",
119                "roboto_condensed",
120                "roboto_slab",
121                "caveat",
122                "times_new_roman",
123                "titan_one",
124                "lemon_tuesday",
125                "roboto_mono",
126                "noto_sans",
127                "plex_sans",
128                "plex_serif",
129                "plex_mono",
130                "spoof",
131                "tiempos_text",
132                "formular",
133            ]
134        ):
135            raise ValueError(
136                "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')"
137            )
138        return value
139
140    @field_validator("text_align")
141    def text_align_validate_enum(cls, value):
142        """Validates the enum"""
143        if value is None:
144            return value
145
146        if value not in set(["left", "right", "center"]):
147            raise ValueError("must be one of enum values ('left', 'right', 'center')")
148        return value
149
150    @field_validator("text_align_vertical")
151    def text_align_vertical_validate_enum(cls, value):
152        """Validates the enum"""
153        if value is None:
154            return value
155
156        if value not in set(["top", "middle", "bottom"]):
157            raise ValueError("must be one of enum values ('top', 'middle', 'bottom')")
158        return value
159
160    model_config = {
161        "populate_by_name": True,
162        "validate_assignment": True,
163        "protected_namespaces": (),
164    }
165
166    def to_str(self) -> str:
167        """Returns the string representation of the model using alias"""
168        return pprint.pformat(self.model_dump(by_alias=True))
169
170    def to_json(self) -> str:
171        """Returns the JSON representation of the model using alias"""
172        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
173        return json.dumps(self.to_dict())
174
175    @classmethod
176    def from_json(cls, json_str: str) -> Optional[Self]:
177        """Create an instance of UpdateShapeStyle from a JSON string"""
178        return cls.from_dict(json.loads(json_str))
179
180    def to_dict(self) -> Dict[str, Any]:
181        """Return the dictionary representation of the model using alias.
182
183        This has the following differences from calling pydantic's
184        `self.model_dump(by_alias=True)`:
185
186        * `None` is only added to the output dict for nullable fields that
187          were set at model initialization. Other fields with value `None`
188          are ignored.
189        * Fields in `self.additional_properties` are added to the output dict.
190        """
191        excluded_fields: Set[str] = set(
192            [
193                "additional_properties",
194            ]
195        )
196
197        _dict = self.model_dump(
198            by_alias=True,
199            exclude=excluded_fields,
200            exclude_none=True,
201        )
202        # puts key-value pairs in additional_properties in the top level
203        if self.additional_properties is not None:
204            for _key, _value in self.additional_properties.items():
205                _dict[_key] = _value
206
207        return _dict
208
209    @classmethod
210    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
211        """Create an instance of UpdateShapeStyle from a dict"""
212        if obj is None:
213            return None
214
215        if not isinstance(obj, dict):
216            return cls.model_validate(obj)
217
218        _obj = cls.model_validate(
219            {
220                "borderColor": obj.get("borderColor"),
221                "borderOpacity": obj.get("borderOpacity"),
222                "borderStyle": obj.get("borderStyle"),
223                "borderWidth": obj.get("borderWidth"),
224                "color": obj.get("color"),
225                "fillColor": obj.get("fillColor"),
226                "fillOpacity": obj.get("fillOpacity"),
227                "fontFamily": obj.get("fontFamily"),
228                "fontSize": obj.get("fontSize"),
229                "textAlign": obj.get("textAlign"),
230                "textAlignVertical": obj.get("textAlignVertical"),
231            }
232        )
233        # store additional fields in additional_properties
234        for _key in obj.keys():
235            if _key not in cls.__properties:
236                _obj.additional_properties[_key] = obj.get(_key)
237
238        return _obj
class UpdateShapeStyle(pydantic.main.BaseModel):
 27class UpdateShapeStyle(BaseModel):
 28    """
 29    Contains information about the shape style, such as the border color or opacity.
 30    """  # noqa: E501
 31
 32    border_color: Optional[StrictStr] = Field(
 33        default=None, description="Defines the color of the border of the shape.", alias="borderColor"
 34    )
 35    border_opacity: Optional[Annotated[str, Field(strict=True)]] = Field(
 36        default=None,
 37        description="Defines the opacity level of the shape border. 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",
 38        alias="borderOpacity",
 39    )
 40    border_style: Optional[StrictStr] = Field(
 41        default=None, description="Defines the style used to represent the border of the shape.", alias="borderStyle"
 42    )
 43    border_width: Optional[Annotated[str, Field(strict=True)]] = Field(
 44        default=None, description="Defines the thickness of the shape border, in dp.", alias="borderWidth"
 45    )
 46    color: Optional[StrictStr] = Field(
 47        default=None, description="Hex value representing the color for the text within the shape item."
 48    )
 49    fill_color: Optional[StrictStr] = Field(
 50        default=None,
 51        description="Fill color for the shape. Hex values: `#f5f6f8` `#d5f692` `#d0e17a` `#93d275` `#67c6c0` `#23bfe7` `#a6ccf5` `#7b92ff` `#fff9b1` `#f5d128` `#ff9d48` `#f16c7f` `#ea94bb` `#ffcee0` `#b384bb` `#000000`",
 52        alias="fillColor",
 53    )
 54    fill_opacity: Optional[Annotated[str, Field(strict=True)]] = Field(
 55        default=None,
 56        description="Opacity level of the fill color. Possible values: any number between `0` and `1`, where: `0.0`: the background color is completely transparent or invisible `1.0`: the background color is completely opaque or solid ",
 57        alias="fillOpacity",
 58    )
 59    font_family: Optional[StrictStr] = Field(
 60        default=None, description="Defines the font type for the text in the shape item.", alias="fontFamily"
 61    )
 62    font_size: Optional[Annotated[str, Field(strict=True)]] = Field(
 63        default=None, description="Defines the font size, in dp, for the text on the shape.", alias="fontSize"
 64    )
 65    text_align: Optional[StrictStr] = Field(
 66        default=None, description="Defines how the sticky note text is horizontally aligned.", alias="textAlign"
 67    )
 68    text_align_vertical: Optional[StrictStr] = Field(
 69        default=None, description="Defines how the sticky note text is vertically aligned.", alias="textAlignVertical"
 70    )
 71    additional_properties: Dict[str, Any] = {}
 72    __properties: ClassVar[List[str]] = [
 73        "borderColor",
 74        "borderOpacity",
 75        "borderStyle",
 76        "borderWidth",
 77        "color",
 78        "fillColor",
 79        "fillOpacity",
 80        "fontFamily",
 81        "fontSize",
 82        "textAlign",
 83        "textAlignVertical",
 84    ]
 85
 86    @field_validator("border_style")
 87    def border_style_validate_enum(cls, value):
 88        """Validates the enum"""
 89        if value is None:
 90            return value
 91
 92        if value not in set(["normal", "dotted", "dashed"]):
 93            raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')")
 94        return value
 95
 96    @field_validator("font_family")
 97    def font_family_validate_enum(cls, value):
 98        """Validates the enum"""
 99        if value is None:
100            return value
101
102        if value not in set(
103            [
104                "arial",
105                "abril_fatface",
106                "bangers",
107                "eb_garamond",
108                "georgia",
109                "graduate",
110                "gravitas_one",
111                "fredoka_one",
112                "nixie_one",
113                "open_sans",
114                "permanent_marker",
115                "pt_sans",
116                "pt_sans_narrow",
117                "pt_serif",
118                "rammetto_one",
119                "roboto",
120                "roboto_condensed",
121                "roboto_slab",
122                "caveat",
123                "times_new_roman",
124                "titan_one",
125                "lemon_tuesday",
126                "roboto_mono",
127                "noto_sans",
128                "plex_sans",
129                "plex_serif",
130                "plex_mono",
131                "spoof",
132                "tiempos_text",
133                "formular",
134            ]
135        ):
136            raise ValueError(
137                "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')"
138            )
139        return value
140
141    @field_validator("text_align")
142    def text_align_validate_enum(cls, value):
143        """Validates the enum"""
144        if value is None:
145            return value
146
147        if value not in set(["left", "right", "center"]):
148            raise ValueError("must be one of enum values ('left', 'right', 'center')")
149        return value
150
151    @field_validator("text_align_vertical")
152    def text_align_vertical_validate_enum(cls, value):
153        """Validates the enum"""
154        if value is None:
155            return value
156
157        if value not in set(["top", "middle", "bottom"]):
158            raise ValueError("must be one of enum values ('top', 'middle', 'bottom')")
159        return value
160
161    model_config = {
162        "populate_by_name": True,
163        "validate_assignment": True,
164        "protected_namespaces": (),
165    }
166
167    def to_str(self) -> str:
168        """Returns the string representation of the model using alias"""
169        return pprint.pformat(self.model_dump(by_alias=True))
170
171    def to_json(self) -> str:
172        """Returns the JSON representation of the model using alias"""
173        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
174        return json.dumps(self.to_dict())
175
176    @classmethod
177    def from_json(cls, json_str: str) -> Optional[Self]:
178        """Create an instance of UpdateShapeStyle from a JSON string"""
179        return cls.from_dict(json.loads(json_str))
180
181    def to_dict(self) -> Dict[str, Any]:
182        """Return the dictionary representation of the model using alias.
183
184        This has the following differences from calling pydantic's
185        `self.model_dump(by_alias=True)`:
186
187        * `None` is only added to the output dict for nullable fields that
188          were set at model initialization. Other fields with value `None`
189          are ignored.
190        * Fields in `self.additional_properties` are added to the output dict.
191        """
192        excluded_fields: Set[str] = set(
193            [
194                "additional_properties",
195            ]
196        )
197
198        _dict = self.model_dump(
199            by_alias=True,
200            exclude=excluded_fields,
201            exclude_none=True,
202        )
203        # puts key-value pairs in additional_properties in the top level
204        if self.additional_properties is not None:
205            for _key, _value in self.additional_properties.items():
206                _dict[_key] = _value
207
208        return _dict
209
210    @classmethod
211    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
212        """Create an instance of UpdateShapeStyle from a dict"""
213        if obj is None:
214            return None
215
216        if not isinstance(obj, dict):
217            return cls.model_validate(obj)
218
219        _obj = cls.model_validate(
220            {
221                "borderColor": obj.get("borderColor"),
222                "borderOpacity": obj.get("borderOpacity"),
223                "borderStyle": obj.get("borderStyle"),
224                "borderWidth": obj.get("borderWidth"),
225                "color": obj.get("color"),
226                "fillColor": obj.get("fillColor"),
227                "fillOpacity": obj.get("fillOpacity"),
228                "fontFamily": obj.get("fontFamily"),
229                "fontSize": obj.get("fontSize"),
230                "textAlign": obj.get("textAlign"),
231                "textAlignVertical": obj.get("textAlignVertical"),
232            }
233        )
234        # store additional fields in additional_properties
235        for _key in obj.keys():
236            if _key not in cls.__properties:
237                _obj.additional_properties[_key] = obj.get(_key)
238
239        return _obj

Contains information about the shape style, such as the border color or opacity.

border_color: Optional[Annotated[str, Strict(strict=True)]]
border_opacity: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]]
border_style: Optional[Annotated[str, Strict(strict=True)]]
border_width: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])]]
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)]]
text_align_vertical: Optional[Annotated[str, Strict(strict=True)]]
additional_properties: Dict[str, Any]
@field_validator('border_style')
def border_style_validate_enum(cls, value):
86    @field_validator("border_style")
87    def border_style_validate_enum(cls, value):
88        """Validates the enum"""
89        if value is None:
90            return value
91
92        if value not in set(["normal", "dotted", "dashed"]):
93            raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')")
94        return value

Validates the enum

@field_validator('font_family')
def font_family_validate_enum(cls, value):
 96    @field_validator("font_family")
 97    def font_family_validate_enum(cls, value):
 98        """Validates the enum"""
 99        if value is None:
100            return value
101
102        if value not in set(
103            [
104                "arial",
105                "abril_fatface",
106                "bangers",
107                "eb_garamond",
108                "georgia",
109                "graduate",
110                "gravitas_one",
111                "fredoka_one",
112                "nixie_one",
113                "open_sans",
114                "permanent_marker",
115                "pt_sans",
116                "pt_sans_narrow",
117                "pt_serif",
118                "rammetto_one",
119                "roboto",
120                "roboto_condensed",
121                "roboto_slab",
122                "caveat",
123                "times_new_roman",
124                "titan_one",
125                "lemon_tuesday",
126                "roboto_mono",
127                "noto_sans",
128                "plex_sans",
129                "plex_serif",
130                "plex_mono",
131                "spoof",
132                "tiempos_text",
133                "formular",
134            ]
135        ):
136            raise ValueError(
137                "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')"
138            )
139        return value

Validates the enum

@field_validator('text_align')
def text_align_validate_enum(cls, value):
141    @field_validator("text_align")
142    def text_align_validate_enum(cls, value):
143        """Validates the enum"""
144        if value is None:
145            return value
146
147        if value not in set(["left", "right", "center"]):
148            raise ValueError("must be one of enum values ('left', 'right', 'center')")
149        return value

Validates the enum

@field_validator('text_align_vertical')
def text_align_vertical_validate_enum(cls, value):
151    @field_validator("text_align_vertical")
152    def text_align_vertical_validate_enum(cls, value):
153        """Validates the enum"""
154        if value is None:
155            return value
156
157        if value not in set(["top", "middle", "bottom"]):
158            raise ValueError("must be one of enum values ('top', 'middle', 'bottom')")
159        return value

Validates the enum

model_config = {'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': ()}
def to_str(self) -> str:
167    def to_str(self) -> str:
168        """Returns the string representation of the model using alias"""
169        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
171    def to_json(self) -> str:
172        """Returns the JSON representation of the model using alias"""
173        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
174        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]:
176    @classmethod
177    def from_json(cls, json_str: str) -> Optional[Self]:
178        """Create an instance of UpdateShapeStyle from a JSON string"""
179        return cls.from_dict(json.loads(json_str))

Create an instance of UpdateShapeStyle from a JSON string

def to_dict(self) -> Dict[str, Any]:
181    def to_dict(self) -> Dict[str, Any]:
182        """Return the dictionary representation of the model using alias.
183
184        This has the following differences from calling pydantic's
185        `self.model_dump(by_alias=True)`:
186
187        * `None` is only added to the output dict for nullable fields that
188          were set at model initialization. Other fields with value `None`
189          are ignored.
190        * Fields in `self.additional_properties` are added to the output dict.
191        """
192        excluded_fields: Set[str] = set(
193            [
194                "additional_properties",
195            ]
196        )
197
198        _dict = self.model_dump(
199            by_alias=True,
200            exclude=excluded_fields,
201            exclude_none=True,
202        )
203        # puts key-value pairs in additional_properties in the top level
204        if self.additional_properties is not None:
205            for _key, _value in self.additional_properties.items():
206                _dict[_key] = _value
207
208        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]:
210    @classmethod
211    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
212        """Create an instance of UpdateShapeStyle from a dict"""
213        if obj is None:
214            return None
215
216        if not isinstance(obj, dict):
217            return cls.model_validate(obj)
218
219        _obj = cls.model_validate(
220            {
221                "borderColor": obj.get("borderColor"),
222                "borderOpacity": obj.get("borderOpacity"),
223                "borderStyle": obj.get("borderStyle"),
224                "borderWidth": obj.get("borderWidth"),
225                "color": obj.get("color"),
226                "fillColor": obj.get("fillColor"),
227                "fillOpacity": obj.get("fillOpacity"),
228                "fontFamily": obj.get("fontFamily"),
229                "fontSize": obj.get("fontSize"),
230                "textAlign": obj.get("textAlign"),
231                "textAlignVertical": obj.get("textAlignVertical"),
232            }
233        )
234        # store additional fields in additional_properties
235        for _key in obj.keys():
236            if _key not in cls.__properties:
237                _obj.additional_properties[_key] = obj.get(_key)
238
239        return _obj

Create an instance of UpdateShapeStyle 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 = {'border_color': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='borderColor', alias_priority=2, description='Defines the color of the border of the shape.'), 'border_opacity': FieldInfo(annotation=Union[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])], NoneType], required=False, alias='borderOpacity', alias_priority=2, description='Defines the opacity level of the shape border. 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'), 'border_style': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='borderStyle', alias_priority=2, description='Defines the style used to represent the border of the shape.'), 'border_width': FieldInfo(annotation=Union[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True)])], NoneType], required=False, alias='borderWidth', alias_priority=2, description='Defines the thickness of the shape border, in dp.'), 'color': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, description='Hex value representing the color for the text within the shape item.'), 'fill_color': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='fillColor', alias_priority=2, description='Fill color for the shape. Hex values: `#f5f6f8` `#d5f692` `#d0e17a` `#93d275` `#67c6c0` `#23bfe7` `#a6ccf5` `#7b92ff` `#fff9b1` `#f5d128` `#ff9d48` `#f16c7f` `#ea94bb` `#ffcee0` `#b384bb` `#000000`'), '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 fill color. Possible values: any number between `0` and `1`, 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='Defines the font type for the text in the shape 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='Defines the font size, in dp, for the text on the shape.'), 'text_align': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='textAlign', alias_priority=2, description='Defines how the sticky note text is horizontally aligned.'), 'text_align_vertical': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='textAlignVertical', alias_priority=2, description='Defines how the sticky note text is vertically aligned.'), '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