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