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 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 UpdateConnectorStyle(BaseModel): 27 """ 28 Contains information about the style of a connector, such as the color or caption font size 29 """ # noqa: E501 30 31 color: Optional[StrictStr] = Field( 32 default=None, description="Hex value representing the color for the captions on the connector." 33 ) 34 end_stroke_cap: Optional[StrictStr] = Field( 35 default=None, 36 description="The decoration cap of the connector end, like an arrow or circle.", 37 alias="endStrokeCap", 38 ) 39 font_size: Optional[Annotated[str, Field(strict=True)]] = Field( 40 default=None, description="Defines the font size, in dp, for the captions on the connector.", alias="fontSize" 41 ) 42 start_stroke_cap: Optional[StrictStr] = Field( 43 default=None, 44 description="The decoration cap of the connector end, like an arrow or circle.", 45 alias="startStrokeCap", 46 ) 47 stroke_color: Optional[StrictStr] = Field( 48 default=None, description="Hex value of the color of the connector line.", alias="strokeColor" 49 ) 50 stroke_style: Optional[StrictStr] = Field( 51 default=None, description="The stroke pattern of the connector line.", alias="strokeStyle" 52 ) 53 stroke_width: Optional[Annotated[str, Field(strict=True)]] = Field( 54 default=None, description="The thickness of the connector line, in dp.", alias="strokeWidth" 55 ) 56 text_orientation: Optional[StrictStr] = Field( 57 default=None, 58 description="The captions orientation relatively to the connector line curvature.", 59 alias="textOrientation", 60 ) 61 additional_properties: Dict[str, Any] = {} 62 __properties: ClassVar[List[str]] = [ 63 "color", 64 "endStrokeCap", 65 "fontSize", 66 "startStrokeCap", 67 "strokeColor", 68 "strokeStyle", 69 "strokeWidth", 70 "textOrientation", 71 ] 72 73 @field_validator("end_stroke_cap") 74 def end_stroke_cap_validate_enum(cls, value): 75 """Validates the enum""" 76 if value is None: 77 return value 78 79 if value not in set( 80 [ 81 "none", 82 "stealth", 83 "rounded_stealth", 84 "diamond", 85 "filled_diamond", 86 "oval", 87 "filled_oval", 88 "arrow", 89 "triangle", 90 "filled_triangle", 91 "erd_one", 92 "erd_many", 93 "erd_only_one", 94 "erd_zero_or_one", 95 "erd_one_or_many", 96 "erd_zero_or_many", 97 "unknown", 98 ] 99 ): 100 raise ValueError( 101 "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')" 102 ) 103 return value 104 105 @field_validator("start_stroke_cap") 106 def start_stroke_cap_validate_enum(cls, value): 107 """Validates the enum""" 108 if value is None: 109 return value 110 111 if value not in set( 112 [ 113 "none", 114 "stealth", 115 "rounded_stealth", 116 "diamond", 117 "filled_diamond", 118 "oval", 119 "filled_oval", 120 "arrow", 121 "triangle", 122 "filled_triangle", 123 "erd_one", 124 "erd_many", 125 "erd_only_one", 126 "erd_zero_or_one", 127 "erd_one_or_many", 128 "erd_zero_or_many", 129 "unknown", 130 ] 131 ): 132 raise ValueError( 133 "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')" 134 ) 135 return value 136 137 @field_validator("stroke_style") 138 def stroke_style_validate_enum(cls, value): 139 """Validates the enum""" 140 if value is None: 141 return value 142 143 if value not in set(["normal", "dotted", "dashed"]): 144 raise ValueError("must be one of enum values ('normal', 'dotted', 'dashed')") 145 return value 146 147 @field_validator("text_orientation") 148 def text_orientation_validate_enum(cls, value): 149 """Validates the enum""" 150 if value is None: 151 return value 152 153 if value not in set(["horizontal", "aligned"]): 154 raise ValueError("must be one of enum values ('horizontal', 'aligned')") 155 return value 156 157 model_config = { 158 "populate_by_name": True, 159 "validate_assignment": True, 160 "protected_namespaces": (), 161 } 162 163 def to_str(self) -> str: 164 """Returns the string representation of the model using alias""" 165 return pprint.pformat(self.model_dump(by_alias=True)) 166 167 def to_json(self) -> str: 168 """Returns the JSON representation of the model using alias""" 169 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 170 return json.dumps(self.to_dict()) 171 172 @classmethod 173 def from_json(cls, json_str: str) -> Optional[Self]: 174 """Create an instance of UpdateConnectorStyle from a JSON string""" 175 return cls.from_dict(json.loads(json_str)) 176 177 def to_dict(self) -> Dict[str, Any]: 178 """Return the dictionary representation of the model using alias. 179 180 This has the following differences from calling pydantic's 181 `self.model_dump(by_alias=True)`: 182 183 * `None` is only added to the output dict for nullable fields that 184 were set at model initialization. Other fields with value `None` 185 are ignored. 186 * Fields in `self.additional_properties` are added to the output dict. 187 """ 188 excluded_fields: Set[str] = set( 189 [ 190 "additional_properties", 191 ] 192 ) 193 194 _dict = self.model_dump( 195 by_alias=True, 196 exclude=excluded_fields, 197 exclude_none=True, 198 ) 199 # puts key-value pairs in additional_properties in the top level 200 if self.additional_properties is not None: 201 for _key, _value in self.additional_properties.items(): 202 _dict[_key] = _value 203 204 return _dict 205 206 @classmethod 207 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 208 """Create an instance of UpdateConnectorStyle from a dict""" 209 if obj is None: 210 return None 211 212 if not isinstance(obj, dict): 213 return cls.model_validate(obj) 214 215 _obj = cls.model_validate( 216 { 217 "color": obj.get("color"), 218 "endStrokeCap": obj.get("endStrokeCap"), 219 "fontSize": obj.get("fontSize"), 220 "startStrokeCap": obj.get("startStrokeCap"), 221 "strokeColor": obj.get("strokeColor"), 222 "strokeStyle": obj.get("strokeStyle"), 223 "strokeWidth": obj.get("strokeWidth"), 224 "textOrientation": obj.get("textOrientation"), 225 } 226 ) 227 # store additional fields in additional_properties 228 for _key in obj.keys(): 229 if _key not in cls.__properties: 230 _obj.additional_properties[_key] = obj.get(_key) 231 232 return _obj
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
Contains information about the style of a connector, such as the color or caption font size
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
Validates the enum
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
Validates the enum
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
Validates the enum
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
Validates the enum
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))
Returns the string representation of the model using alias
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())
Returns the JSON representation of the model using alias
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))
Create an instance of UpdateConnectorStyle from a JSON string
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
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
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
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