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