miro_api.models.shape_style_for_create

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

Validates the enum

@field_validator('font_family')
def font_family_validate_enum(cls, value):
112    @field_validator("font_family")
113    def font_family_validate_enum(cls, value):
114        """Validates the enum"""
115        if value is None:
116            return value
117
118        if value not in set(
119            [
120                "arial",
121                "abril_fatface",
122                "bangers",
123                "eb_garamond",
124                "georgia",
125                "graduate",
126                "gravitas_one",
127                "fredoka_one",
128                "nixie_one",
129                "open_sans",
130                "permanent_marker",
131                "pt_sans",
132                "pt_sans_narrow",
133                "pt_serif",
134                "rammetto_one",
135                "roboto",
136                "roboto_condensed",
137                "roboto_slab",
138                "caveat",
139                "times_new_roman",
140                "titan_one",
141                "lemon_tuesday",
142                "roboto_mono",
143                "noto_sans",
144                "plex_sans",
145                "plex_serif",
146                "plex_mono",
147                "spoof",
148                "tiempos_text",
149                "formular",
150            ]
151        ):
152            raise ValueError(
153                "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')"
154            )
155        return value

Validates the enum

@field_validator('text_align')
def text_align_validate_enum(cls, value):
157    @field_validator("text_align")
158    def text_align_validate_enum(cls, value):
159        """Validates the enum"""
160        if value is None:
161            return value
162
163        if value not in set(["left", "right", "center", "unknown"]):
164            raise ValueError("must be one of enum values ('left', 'right', 'center', 'unknown')")
165        return value

Validates the enum

@field_validator('text_align_vertical')
def text_align_vertical_validate_enum(cls, value):
167    @field_validator("text_align_vertical")
168    def text_align_vertical_validate_enum(cls, value):
169        """Validates the enum"""
170        if value is None:
171            return value
172
173        if value not in set(["top", "middle", "bottom", "unknown"]):
174            raise ValueError("must be one of enum values ('top', 'middle', 'bottom', 'unknown')")
175        return value

Validates the enum

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

Returns the string representation of the model using alias

def to_json(self) -> str:
187    def to_json(self) -> str:
188        """Returns the JSON representation of the model using alias"""
189        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
190        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]:
192    @classmethod
193    def from_json(cls, json_str: str) -> Optional[Self]:
194        """Create an instance of ShapeStyleForCreate from a JSON string"""
195        return cls.from_dict(json.loads(json_str))

Create an instance of ShapeStyleForCreate from a JSON string

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

Create an instance of ShapeStyleForCreate 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. Default: `#1a1a1a` (dark gray).'), '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 Default: `1.0` (solid color).'), '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. Default: `normal`.'), '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. Default: `2.0`.'), '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. Default: `#1a1a1a`.'), '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` Default: #ffffff.'), '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 Default: `Flowchart` shapes: `1.0`. `Basic` shapes: `1.0` if `fillColor` provided, `0.0` if no `fillColor` provided. '), '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. Default: `arial`.'), '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. Default: `14`.'), 'text_align': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='textAlign', alias_priority=2, description='Defines how the shape text is horizontally aligned. Default: Flowchart shapes: `center`. Basic shapes: `left`. `unknown` is returned for unsupported shapes.'), 'text_align_vertical': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='textAlignVertical', alias_priority=2, description='Defines how the shape text is vertically aligned. Default: Flowchart shapes: `middle`. Basic shapes: `top`. `unknown` is returned for unsupported shapes.'), '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