miro_api.models.update_connector_style
Miro Developer Platform
### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? Read our introduction page and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - Quickstart (video): try the REST API in less than 3 minutes. - Quickstart (article): get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - Get started with OAuth 2.0 and Miro ### Miro App Examples Clone our Miro App Examples repository to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0.
The version of the OpenAPI document: v2.0 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4Miro Developer Platform 5 6<img src=\"https://content.pstmn.io/47449ea6-0ef7-4af2-bac1-e58a70e61c58/aW1hZ2UucG5n\" width=\"1685\" height=\"593\"> ### Miro Developer Platform concepts - New to the Miro Developer Platform? Interested in learning more about platform concepts?? [Read our introduction page](https://beta.developers.miro.com/docs/introduction) and familiarize yourself with the Miro Developer Platform capabilities in a few minutes. ### Getting started with the Miro REST API - [Quickstart (video):](https://beta.developers.miro.com/docs/try-out-the-rest-api-in-less-than-3-minutes) try the REST API in less than 3 minutes. - [Quickstart (article):](https://beta.developers.miro.com/docs/build-your-first-hello-world-app-1) get started and try the REST API in less than 3 minutes. ### Miro REST API tutorials Check out our how-to articles with step-by-step instructions and code examples so you can: - [Get started with OAuth 2.0 and Miro](https://beta.developers.miro.com/docs/getting-started-with-oauth) ### Miro App Examples Clone our [Miro App Examples repository](https://github.com/miroapp/app-examples) to get inspiration, customize, and explore apps built on top of Miro's Developer Platform 2.0. 7 8The version of the OpenAPI document: v2.0 9Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import pprint 17import re # noqa: F401 18import json 19 20from pydantic import BaseModel, Field, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List, Optional 22from typing_extensions import Annotated 23from typing import Optional, Set 24from typing_extensions import Self 25 26 27class UpdateConnectorStyle(BaseModel): 28 """ 29 Contains information about the style of a connector, such as the color or caption font size 30 """ # noqa: E501 31 32 color: Optional[StrictStr] = Field( 33 default=None, description="Hex value representing the color for the captions on the connector." 34 ) 35 end_stroke_cap: Optional[StrictStr] = Field( 36 default=None, 37 description="The decoration cap of the connector end, like an arrow or circle.", 38 alias="endStrokeCap", 39 ) 40 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 41 default=None, description="Defines the font size, in dp, for the captions on the connector.", alias="fontSize" 42 ) 43 start_stroke_cap: Optional[StrictStr] = Field( 44 default=None, 45 description="The decoration cap of the connector end, like an arrow or circle.", 46 alias="startStrokeCap", 47 ) 48 stroke_color: Optional[StrictStr] = Field( 49 default=None, description="Hex value of the color of the connector line.", alias="strokeColor" 50 ) 51 stroke_style: Optional[StrictStr] = Field( 52 default=None, description="The stroke pattern of the connector line.", alias="strokeStyle" 53 ) 54 stroke_width: Optional[Annotated[str, Field(strict=True)]] = Field( 55 default=None, description="The thickness of the connector line, in dp.", alias="strokeWidth" 56 ) 57 text_orientation: Optional[StrictStr] = Field( 58 default=None, 59 description="The captions orientation relatively to the connector line curvature.", 60 alias="textOrientation", 61 ) 62 additional_properties: Dict[str, Any] = {} 63 __properties: ClassVar[List[str]] = [ 64 "color", 65 "endStrokeCap", 66 "fontSize", 67 "startStrokeCap", 68 "strokeColor", 69 "strokeStyle", 70 "strokeWidth", 71 "textOrientation", 72 ] 73 74 @field_validator("end_stroke_cap") 75 def end_stroke_cap_validate_enum(cls, value): 76 """Validates the enum""" 77 if value is None: 78 return value 79 80 if value not in set( 81 [ 82 "none", 83 "stealth", 84 "rounded_stealth", 85 "diamond", 86 "filled_diamond", 87 "oval", 88 "filled_oval", 89 "arrow", 90 "triangle", 91 "filled_triangle", 92 "erd_one", 93 "erd_many", 94 "erd_only_one", 95 "erd_zero_or_one", 96 "erd_one_or_many", 97 "erd_zero_or_many", 98 "unknown", 99 ] 100 ): 101 raise ValueError( 102 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 103 ) 104 return value 105 106 @field_validator("start_stroke_cap") 107 def start_stroke_cap_validate_enum(cls, value): 108 """Validates the enum""" 109 if value is None: 110 return value 111 112 if value not in set( 113 [ 114 "none", 115 "stealth", 116 "rounded_stealth", 117 "diamond", 118 "filled_diamond", 119 "oval", 120 "filled_oval", 121 "arrow", 122 "triangle", 123 "filled_triangle", 124 "erd_one", 125 "erd_many", 126 "erd_only_one", 127 "erd_zero_or_one", 128 "erd_one_or_many", 129 "erd_zero_or_many", 130 "unknown", 131 ] 132 ): 133 raise ValueError( 134 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 135 ) 136 return value 137 138 @field_validator("stroke_style") 139 def stroke_style_validate_enum(cls, value): 140 """Validates the enum""" 141 if value is None: 142 return value 143 144 if value not in set(["normal", "dotted", "dashed"]): 145 raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')") 146 return value 147 148 @field_validator("text_orientation") 149 def text_orientation_validate_enum(cls, value): 150 """Validates the enum""" 151 if value is None: 152 return value 153 154 if value not in set(["horizontal", "aligned"]): 155 raise ValueError("must be one of enum values ('horizontal', 'aligned')") 156 return value 157 158 model_config = { 159 "populate_by_name": True, 160 "validate_assignment": True, 161 "protected_namespaces": (), 162 } 163 164 def to_str(self) -> str: 165 """Returns the string representation of the model using alias""" 166 return pprint.pformat(self.model_dump(by_alias=True)) 167 168 def to_json(self) -> str: 169 """Returns the JSON representation of the model using alias""" 170 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 171 return json.dumps(self.to_dict()) 172 173 @classmethod 174 def from_json(cls, json_str: str) -> Optional[Self]: 175 """Create an instance of UpdateConnectorStyle from a JSON string""" 176 return cls.from_dict(json.loads(json_str)) 177 178 def to_dict(self) -> Dict[str, Any]: 179 """Return the dictionary representation of the model using alias. 180 181 This has the following differences from calling pydantic's 182 `self.model_dump(by_alias=True)`: 183 184 * `None` is only added to the output dict for nullable fields that 185 were set at model initialization. Other fields with value `None` 186 are ignored. 187 * Fields in `self.additional_properties` are added to the output dict. 188 """ 189 excluded_fields: Set[str] = set( 190 [ 191 "additional_properties", 192 ] 193 ) 194 195 _dict = self.model_dump( 196 by_alias=True, 197 exclude=excluded_fields, 198 exclude_none=True, 199 ) 200 # puts key-value pairs in additional_properties in the top level 201 if self.additional_properties is not None: 202 for _key, _value in self.additional_properties.items(): 203 _dict[_key] = _value 204 205 return _dict 206 207 @classmethod 208 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 209 """Create an instance of UpdateConnectorStyle from a dict""" 210 if obj is None: 211 return None 212 213 if not isinstance(obj, dict): 214 return cls.model_validate(obj) 215 216 _obj = cls.model_validate( 217 { 218 "color": obj.get("color"), 219 "endStrokeCap": obj.get("endStrokeCap"), 220 "fontSize": obj.get("fontSize"), 221 "startStrokeCap": obj.get("startStrokeCap"), 222 "strokeColor": obj.get("strokeColor"), 223 "strokeStyle": obj.get("strokeStyle"), 224 "strokeWidth": obj.get("strokeWidth"), 225 "textOrientation": obj.get("textOrientation"), 226 } 227 ) 228 # store additional fields in additional_properties 229 for _key in obj.keys(): 230 if _key not in cls.__properties: 231 _obj.additional_properties[_key] = obj.get(_key) 232 233 return _obj
28class UpdateConnectorStyle(BaseModel): 29 """ 30 Contains information about the style of a connector, such as the color or caption font size 31 """ # noqa: E501 32 33 color: Optional[StrictStr] = Field( 34 default=None, description="Hex value representing the color for the captions on the connector." 35 ) 36 end_stroke_cap: Optional[StrictStr] = Field( 37 default=None, 38 description="The decoration cap of the connector end, like an arrow or circle.", 39 alias="endStrokeCap", 40 ) 41 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 42 default=None, description="Defines the font size, in dp, for the captions on the connector.", alias="fontSize" 43 ) 44 start_stroke_cap: Optional[StrictStr] = Field( 45 default=None, 46 description="The decoration cap of the connector end, like an arrow or circle.", 47 alias="startStrokeCap", 48 ) 49 stroke_color: Optional[StrictStr] = Field( 50 default=None, description="Hex value of the color of the connector line.", alias="strokeColor" 51 ) 52 stroke_style: Optional[StrictStr] = Field( 53 default=None, description="The stroke pattern of the connector line.", alias="strokeStyle" 54 ) 55 stroke_width: Optional[Annotated[str, Field(strict=True)]] = Field( 56 default=None, description="The thickness of the connector line, in dp.", alias="strokeWidth" 57 ) 58 text_orientation: Optional[StrictStr] = Field( 59 default=None, 60 description="The captions orientation relatively to the connector line curvature.", 61 alias="textOrientation", 62 ) 63 additional_properties: Dict[str, Any] = {} 64 __properties: ClassVar[List[str]] = [ 65 "color", 66 "endStrokeCap", 67 "fontSize", 68 "startStrokeCap", 69 "strokeColor", 70 "strokeStyle", 71 "strokeWidth", 72 "textOrientation", 73 ] 74 75 @field_validator("end_stroke_cap") 76 def end_stroke_cap_validate_enum(cls, value): 77 """Validates the enum""" 78 if value is None: 79 return value 80 81 if value not in set( 82 [ 83 "none", 84 "stealth", 85 "rounded_stealth", 86 "diamond", 87 "filled_diamond", 88 "oval", 89 "filled_oval", 90 "arrow", 91 "triangle", 92 "filled_triangle", 93 "erd_one", 94 "erd_many", 95 "erd_only_one", 96 "erd_zero_or_one", 97 "erd_one_or_many", 98 "erd_zero_or_many", 99 "unknown", 100 ] 101 ): 102 raise ValueError( 103 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 104 ) 105 return value 106 107 @field_validator("start_stroke_cap") 108 def start_stroke_cap_validate_enum(cls, value): 109 """Validates the enum""" 110 if value is None: 111 return value 112 113 if value not in set( 114 [ 115 "none", 116 "stealth", 117 "rounded_stealth", 118 "diamond", 119 "filled_diamond", 120 "oval", 121 "filled_oval", 122 "arrow", 123 "triangle", 124 "filled_triangle", 125 "erd_one", 126 "erd_many", 127 "erd_only_one", 128 "erd_zero_or_one", 129 "erd_one_or_many", 130 "erd_zero_or_many", 131 "unknown", 132 ] 133 ): 134 raise ValueError( 135 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 136 ) 137 return value 138 139 @field_validator("stroke_style") 140 def stroke_style_validate_enum(cls, value): 141 """Validates the enum""" 142 if value is None: 143 return value 144 145 if value not in set(["normal", "dotted", "dashed"]): 146 raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')") 147 return value 148 149 @field_validator("text_orientation") 150 def text_orientation_validate_enum(cls, value): 151 """Validates the enum""" 152 if value is None: 153 return value 154 155 if value not in set(["horizontal", "aligned"]): 156 raise ValueError("must be one of enum values ('horizontal', 'aligned')") 157 return value 158 159 model_config = { 160 "populate_by_name": True, 161 "validate_assignment": True, 162 "protected_namespaces": (), 163 } 164 165 def to_str(self) -> str: 166 """Returns the string representation of the model using alias""" 167 return pprint.pformat(self.model_dump(by_alias=True)) 168 169 def to_json(self) -> str: 170 """Returns the JSON representation of the model using alias""" 171 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 172 return json.dumps(self.to_dict()) 173 174 @classmethod 175 def from_json(cls, json_str: str) -> Optional[Self]: 176 """Create an instance of UpdateConnectorStyle from a JSON string""" 177 return cls.from_dict(json.loads(json_str)) 178 179 def to_dict(self) -> Dict[str, Any]: 180 """Return the dictionary representation of the model using alias. 181 182 This has the following differences from calling pydantic's 183 `self.model_dump(by_alias=True)`: 184 185 * `None` is only added to the output dict for nullable fields that 186 were set at model initialization. Other fields with value `None` 187 are ignored. 188 * Fields in `self.additional_properties` are added to the output dict. 189 """ 190 excluded_fields: Set[str] = set( 191 [ 192 "additional_properties", 193 ] 194 ) 195 196 _dict = self.model_dump( 197 by_alias=True, 198 exclude=excluded_fields, 199 exclude_none=True, 200 ) 201 # puts key-value pairs in additional_properties in the top level 202 if self.additional_properties is not None: 203 for _key, _value in self.additional_properties.items(): 204 _dict[_key] = _value 205 206 return _dict 207 208 @classmethod 209 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 210 """Create an instance of UpdateConnectorStyle from a dict""" 211 if obj is None: 212 return None 213 214 if not isinstance(obj, dict): 215 return cls.model_validate(obj) 216 217 _obj = cls.model_validate( 218 { 219 "color": obj.get("color"), 220 "endStrokeCap": obj.get("endStrokeCap"), 221 "fontSize": obj.get("fontSize"), 222 "startStrokeCap": obj.get("startStrokeCap"), 223 "strokeColor": obj.get("strokeColor"), 224 "strokeStyle": obj.get("strokeStyle"), 225 "strokeWidth": obj.get("strokeWidth"), 226 "textOrientation": obj.get("textOrientation"), 227 } 228 ) 229 # store additional fields in additional_properties 230 for _key in obj.keys(): 231 if _key not in cls.__properties: 232 _obj.additional_properties[_key] = obj.get(_key) 233 234 return _obj
Contains information about the style of a connector, such as the color or caption font size
75 @field_validator("end_stroke_cap") 76 def end_stroke_cap_validate_enum(cls, value): 77 """Validates the enum""" 78 if value is None: 79 return value 80 81 if value not in set( 82 [ 83 "none", 84 "stealth", 85 "rounded_stealth", 86 "diamond", 87 "filled_diamond", 88 "oval", 89 "filled_oval", 90 "arrow", 91 "triangle", 92 "filled_triangle", 93 "erd_one", 94 "erd_many", 95 "erd_only_one", 96 "erd_zero_or_one", 97 "erd_one_or_many", 98 "erd_zero_or_many", 99 "unknown", 100 ] 101 ): 102 raise ValueError( 103 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 104 ) 105 return value
Validates the enum
107 @field_validator("start_stroke_cap") 108 def start_stroke_cap_validate_enum(cls, value): 109 """Validates the enum""" 110 if value is None: 111 return value 112 113 if value not in set( 114 [ 115 "none", 116 "stealth", 117 "rounded_stealth", 118 "diamond", 119 "filled_diamond", 120 "oval", 121 "filled_oval", 122 "arrow", 123 "triangle", 124 "filled_triangle", 125 "erd_one", 126 "erd_many", 127 "erd_only_one", 128 "erd_zero_or_one", 129 "erd_one_or_many", 130 "erd_zero_or_many", 131 "unknown", 132 ] 133 ): 134 raise ValueError( 135 "must be one of enum values ('none', 'stealth', 'rounded_stealth', 'diamond', 'filled_diamond', 'oval', 'filled_oval', 'arrow', 'triangle', 'filled_triangle', 'erd_one', 'erd_many', 'erd_only_one', 'erd_zero_or_one', 'erd_one_or_many', 'erd_zero_or_many', 'unknown')" 136 ) 137 return value
Validates the enum
139 @field_validator("stroke_style") 140 def stroke_style_validate_enum(cls, value): 141 """Validates the enum""" 142 if value is None: 143 return value 144 145 if value not in set(["normal", "dotted", "dashed"]): 146 raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')") 147 return value
Validates the enum
149 @field_validator("text_orientation") 150 def text_orientation_validate_enum(cls, value): 151 """Validates the enum""" 152 if value is None: 153 return value 154 155 if value not in set(["horizontal", "aligned"]): 156 raise ValueError("must be one of enum values ('horizontal', 'aligned')") 157 return value
Validates the enum
165 def to_str(self) -> str: 166 """Returns the string representation of the model using alias""" 167 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
169 def to_json(self) -> str: 170 """Returns the JSON representation of the model using alias""" 171 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 172 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
174 @classmethod 175 def from_json(cls, json_str: str) -> Optional[Self]: 176 """Create an instance of UpdateConnectorStyle from a JSON string""" 177 return cls.from_dict(json.loads(json_str))
Create an instance of UpdateConnectorStyle from a JSON string
179 def to_dict(self) -> Dict[str, Any]: 180 """Return the dictionary representation of the model using alias. 181 182 This has the following differences from calling pydantic's 183 `self.model_dump(by_alias=True)`: 184 185 * `None` is only added to the output dict for nullable fields that 186 were set at model initialization. Other fields with value `None` 187 are ignored. 188 * Fields in `self.additional_properties` are added to the output dict. 189 """ 190 excluded_fields: Set[str] = set( 191 [ 192 "additional_properties", 193 ] 194 ) 195 196 _dict = self.model_dump( 197 by_alias=True, 198 exclude=excluded_fields, 199 exclude_none=True, 200 ) 201 # puts key-value pairs in additional_properties in the top level 202 if self.additional_properties is not None: 203 for _key, _value in self.additional_properties.items(): 204 _dict[_key] = _value 205 206 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 valueNone
are ignored.- Fields in
self.additional_properties
are added to the output dict.
208 @classmethod 209 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 210 """Create an instance of UpdateConnectorStyle from a dict""" 211 if obj is None: 212 return None 213 214 if not isinstance(obj, dict): 215 return cls.model_validate(obj) 216 217 _obj = cls.model_validate( 218 { 219 "color": obj.get("color"), 220 "endStrokeCap": obj.get("endStrokeCap"), 221 "fontSize": obj.get("fontSize"), 222 "startStrokeCap": obj.get("startStrokeCap"), 223 "strokeColor": obj.get("strokeColor"), 224 "strokeStyle": obj.get("strokeStyle"), 225 "strokeWidth": obj.get("strokeWidth"), 226 "textOrientation": obj.get("textOrientation"), 227 } 228 ) 229 # store additional fields in additional_properties 230 for _key in obj.keys(): 231 if _key not in cls.__properties: 232 _obj.additional_properties[_key] = obj.get(_key) 233 234 return _obj
Create an instance of UpdateConnectorStyle from a dict
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.
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