miro_api.models.shape_style_for_update

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

Contains information about the shape style, such as the border color or opacity.
All properties in style object are supported for shape types aren't listed below.

Shape type Unsupported properties
flow_chart_or fontSize, fontFamily, color, textAlign, textAlignVertical
flow_chart_summing_junction fontSize, fontFamily, color, textAlign, textAlignVertical
flow_chart_note_curly_left fillColor, fillOpacity
flow_chart_note_curly_right fillColor, fillOpacity
flow_chart_note_square fillColor, fillOpacity

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):
87    @field_validator("border_style")
88    def border_style_validate_enum(cls, value):
89        """Validates the enum"""
90        if value is None:
91            return value
92
93        if value not in set(["normal", "dotted", "dashed"]):
94            raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')")
95        return value

Validates the enum

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

Validates the enum

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

Validates the enum

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

Validates the enum

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

Returns the string representation of the model using alias

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

Create an instance of ShapeStyleForUpdate from a JSON string

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

Create an instance of ShapeStyleForUpdate 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