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

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):
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

Validates the enum

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

Validates the enum

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

Validates the enum

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

Validates the enum

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

Returns the string representation of the model using alias

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

Returns the JSON representation of the model using alias

@classmethod
def from_json(cls, json_str: str) -> Optional[typing_extensions.Self]:
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))

Create an instance of ShapeStyleForCreate from a JSON string

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

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]:
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

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