miro_api.models.connector_with_links
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 datetime import datetime 20from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List, Optional 22from miro_api.models.caption import Caption 23from miro_api.models.connector_style import ConnectorStyle 24from miro_api.models.created_by import CreatedBy 25from miro_api.models.item_connection_with_links import ItemConnectionWithLinks 26from miro_api.models.modified_by import ModifiedBy 27from miro_api.models.self_link import SelfLink 28from typing import Optional, Set 29from typing_extensions import Self 30 31 32class ConnectorWithLinks(BaseModel): 33 """ 34 Contains the result data. 35 """ # noqa: E501 36 37 captions: Optional[List[Caption]] = Field( 38 default=None, description="Blocks of text you want to display on the connector." 39 ) 40 created_at: Optional[datetime] = Field( 41 default=None, 42 description="Date and time when the connector was created. <br>Format: UTC, adheres to [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), includes a [trailing Z offset](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)).", 43 alias="createdAt", 44 ) 45 created_by: Optional[CreatedBy] = Field(default=None, alias="createdBy") 46 end_item: Optional[ItemConnectionWithLinks] = Field(default=None, alias="endItem") 47 id: StrictStr = Field(description="Unique identifier (ID) of a connector.") 48 is_supported: Optional[StrictBool] = Field( 49 default=None, 50 description="Indicates whether the connector is supported at the moment. If this parameter returns `false`, we do not support the connector at the moment. We do not allow updates for unsupported connectors and we might not return all data about the connector, such as intermediate points and connection points to the canvas.", 51 alias="isSupported", 52 ) 53 links: Optional[SelfLink] = None 54 modified_at: Optional[datetime] = Field( 55 default=None, 56 description="Date and time when the connector was last modified. <br>Format: UTC, adheres to [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), includes a [trailing Z offset](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)).", 57 alias="modifiedAt", 58 ) 59 modified_by: Optional[ModifiedBy] = Field(default=None, alias="modifiedBy") 60 shape: Optional[StrictStr] = Field( 61 default="curved", description="The path type of the connector line, defines curvature. Default: curved." 62 ) 63 start_item: Optional[ItemConnectionWithLinks] = Field(default=None, alias="startItem") 64 style: Optional[ConnectorStyle] = None 65 type: Optional[StrictStr] = Field(default=None, description="Type of board object that is returned.") 66 additional_properties: Dict[str, Any] = {} 67 __properties: ClassVar[List[str]] = [ 68 "captions", 69 "createdAt", 70 "createdBy", 71 "endItem", 72 "id", 73 "isSupported", 74 "links", 75 "modifiedAt", 76 "modifiedBy", 77 "shape", 78 "startItem", 79 "style", 80 "type", 81 ] 82 83 @field_validator("shape") 84 def shape_validate_enum(cls, value): 85 """Validates the enum""" 86 if value is None: 87 return value 88 89 if value not in set(["straight", "elbowed", "curved"]): 90 raise ValueError("must be one of enum values ('straight', 'elbowed', 'curved')") 91 return value 92 93 model_config = { 94 "populate_by_name": True, 95 "validate_assignment": True, 96 "protected_namespaces": (), 97 } 98 99 def to_str(self) -> str: 100 """Returns the string representation of the model using alias""" 101 return pprint.pformat(self.model_dump(by_alias=True)) 102 103 def to_json(self) -> str: 104 """Returns the JSON representation of the model using alias""" 105 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 106 return json.dumps(self.to_dict()) 107 108 @classmethod 109 def from_json(cls, json_str: str) -> Optional[Self]: 110 """Create an instance of ConnectorWithLinks from a JSON string""" 111 return cls.from_dict(json.loads(json_str)) 112 113 def to_dict(self) -> Dict[str, Any]: 114 """Return the dictionary representation of the model using alias. 115 116 This has the following differences from calling pydantic's 117 `self.model_dump(by_alias=True)`: 118 119 * `None` is only added to the output dict for nullable fields that 120 were set at model initialization. Other fields with value `None` 121 are ignored. 122 * Fields in `self.additional_properties` are added to the output dict. 123 """ 124 excluded_fields: Set[str] = set( 125 [ 126 "additional_properties", 127 ] 128 ) 129 130 _dict = self.model_dump( 131 by_alias=True, 132 exclude=excluded_fields, 133 exclude_none=True, 134 ) 135 # override the default output from pydantic by calling `to_dict()` of each item in captions (list) 136 _items = [] 137 if self.captions: 138 for _item in self.captions: 139 if _item: 140 _items.append(_item.to_dict()) 141 _dict["captions"] = _items 142 # override the default output from pydantic by calling `to_dict()` of created_by 143 if self.created_by: 144 _dict["createdBy"] = self.created_by.to_dict() 145 # override the default output from pydantic by calling `to_dict()` of end_item 146 if self.end_item: 147 _dict["endItem"] = self.end_item.to_dict() 148 # override the default output from pydantic by calling `to_dict()` of links 149 if self.links: 150 _dict["links"] = self.links.to_dict() 151 # override the default output from pydantic by calling `to_dict()` of modified_by 152 if self.modified_by: 153 _dict["modifiedBy"] = self.modified_by.to_dict() 154 # override the default output from pydantic by calling `to_dict()` of start_item 155 if self.start_item: 156 _dict["startItem"] = self.start_item.to_dict() 157 # override the default output from pydantic by calling `to_dict()` of style 158 if self.style: 159 _dict["style"] = self.style.to_dict() 160 # puts key-value pairs in additional_properties in the top level 161 if self.additional_properties is not None: 162 for _key, _value in self.additional_properties.items(): 163 _dict[_key] = _value 164 165 return _dict 166 167 @classmethod 168 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 169 """Create an instance of ConnectorWithLinks from a dict""" 170 if obj is None: 171 return None 172 173 if not isinstance(obj, dict): 174 return cls.model_validate(obj) 175 176 _obj = cls.model_validate( 177 { 178 "captions": ( 179 [Caption.from_dict(_item) for _item in obj["captions"]] if obj.get("captions") is not None else None 180 ), 181 "createdAt": obj.get("createdAt"), 182 "createdBy": CreatedBy.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 183 "endItem": ( 184 ItemConnectionWithLinks.from_dict(obj["endItem"]) if obj.get("endItem") is not None else None 185 ), 186 "id": obj.get("id"), 187 "isSupported": obj.get("isSupported"), 188 "links": SelfLink.from_dict(obj["links"]) if obj.get("links") is not None else None, 189 "modifiedAt": obj.get("modifiedAt"), 190 "modifiedBy": ModifiedBy.from_dict(obj["modifiedBy"]) if obj.get("modifiedBy") is not None else None, 191 "shape": obj.get("shape") if obj.get("shape") is not None else "curved", 192 "startItem": ( 193 ItemConnectionWithLinks.from_dict(obj["startItem"]) if obj.get("startItem") is not None else None 194 ), 195 "style": ConnectorStyle.from_dict(obj["style"]) if obj.get("style") is not None else None, 196 "type": obj.get("type"), 197 } 198 ) 199 # store additional fields in additional_properties 200 for _key in obj.keys(): 201 if _key not in cls.__properties: 202 _obj.additional_properties[_key] = obj.get(_key) 203 204 return _obj
33class ConnectorWithLinks(BaseModel): 34 """ 35 Contains the result data. 36 """ # noqa: E501 37 38 captions: Optional[List[Caption]] = Field( 39 default=None, description="Blocks of text you want to display on the connector." 40 ) 41 created_at: Optional[datetime] = Field( 42 default=None, 43 description="Date and time when the connector was created. <br>Format: UTC, adheres to [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), includes a [trailing Z offset](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)).", 44 alias="createdAt", 45 ) 46 created_by: Optional[CreatedBy] = Field(default=None, alias="createdBy") 47 end_item: Optional[ItemConnectionWithLinks] = Field(default=None, alias="endItem") 48 id: StrictStr = Field(description="Unique identifier (ID) of a connector.") 49 is_supported: Optional[StrictBool] = Field( 50 default=None, 51 description="Indicates whether the connector is supported at the moment. If this parameter returns `false`, we do not support the connector at the moment. We do not allow updates for unsupported connectors and we might not return all data about the connector, such as intermediate points and connection points to the canvas.", 52 alias="isSupported", 53 ) 54 links: Optional[SelfLink] = None 55 modified_at: Optional[datetime] = Field( 56 default=None, 57 description="Date and time when the connector was last modified. <br>Format: UTC, adheres to [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), includes a [trailing Z offset](https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)).", 58 alias="modifiedAt", 59 ) 60 modified_by: Optional[ModifiedBy] = Field(default=None, alias="modifiedBy") 61 shape: Optional[StrictStr] = Field( 62 default="curved", description="The path type of the connector line, defines curvature. Default: curved." 63 ) 64 start_item: Optional[ItemConnectionWithLinks] = Field(default=None, alias="startItem") 65 style: Optional[ConnectorStyle] = None 66 type: Optional[StrictStr] = Field(default=None, description="Type of board object that is returned.") 67 additional_properties: Dict[str, Any] = {} 68 __properties: ClassVar[List[str]] = [ 69 "captions", 70 "createdAt", 71 "createdBy", 72 "endItem", 73 "id", 74 "isSupported", 75 "links", 76 "modifiedAt", 77 "modifiedBy", 78 "shape", 79 "startItem", 80 "style", 81 "type", 82 ] 83 84 @field_validator("shape") 85 def shape_validate_enum(cls, value): 86 """Validates the enum""" 87 if value is None: 88 return value 89 90 if value not in set(["straight", "elbowed", "curved"]): 91 raise ValueError("must be one of enum values ('straight', 'elbowed', 'curved')") 92 return value 93 94 model_config = { 95 "populate_by_name": True, 96 "validate_assignment": True, 97 "protected_namespaces": (), 98 } 99 100 def to_str(self) -> str: 101 """Returns the string representation of the model using alias""" 102 return pprint.pformat(self.model_dump(by_alias=True)) 103 104 def to_json(self) -> str: 105 """Returns the JSON representation of the model using alias""" 106 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 107 return json.dumps(self.to_dict()) 108 109 @classmethod 110 def from_json(cls, json_str: str) -> Optional[Self]: 111 """Create an instance of ConnectorWithLinks from a JSON string""" 112 return cls.from_dict(json.loads(json_str)) 113 114 def to_dict(self) -> Dict[str, Any]: 115 """Return the dictionary representation of the model using alias. 116 117 This has the following differences from calling pydantic's 118 `self.model_dump(by_alias=True)`: 119 120 * `None` is only added to the output dict for nullable fields that 121 were set at model initialization. Other fields with value `None` 122 are ignored. 123 * Fields in `self.additional_properties` are added to the output dict. 124 """ 125 excluded_fields: Set[str] = set( 126 [ 127 "additional_properties", 128 ] 129 ) 130 131 _dict = self.model_dump( 132 by_alias=True, 133 exclude=excluded_fields, 134 exclude_none=True, 135 ) 136 # override the default output from pydantic by calling `to_dict()` of each item in captions (list) 137 _items = [] 138 if self.captions: 139 for _item in self.captions: 140 if _item: 141 _items.append(_item.to_dict()) 142 _dict["captions"] = _items 143 # override the default output from pydantic by calling `to_dict()` of created_by 144 if self.created_by: 145 _dict["createdBy"] = self.created_by.to_dict() 146 # override the default output from pydantic by calling `to_dict()` of end_item 147 if self.end_item: 148 _dict["endItem"] = self.end_item.to_dict() 149 # override the default output from pydantic by calling `to_dict()` of links 150 if self.links: 151 _dict["links"] = self.links.to_dict() 152 # override the default output from pydantic by calling `to_dict()` of modified_by 153 if self.modified_by: 154 _dict["modifiedBy"] = self.modified_by.to_dict() 155 # override the default output from pydantic by calling `to_dict()` of start_item 156 if self.start_item: 157 _dict["startItem"] = self.start_item.to_dict() 158 # override the default output from pydantic by calling `to_dict()` of style 159 if self.style: 160 _dict["style"] = self.style.to_dict() 161 # puts key-value pairs in additional_properties in the top level 162 if self.additional_properties is not None: 163 for _key, _value in self.additional_properties.items(): 164 _dict[_key] = _value 165 166 return _dict 167 168 @classmethod 169 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 170 """Create an instance of ConnectorWithLinks from a dict""" 171 if obj is None: 172 return None 173 174 if not isinstance(obj, dict): 175 return cls.model_validate(obj) 176 177 _obj = cls.model_validate( 178 { 179 "captions": ( 180 [Caption.from_dict(_item) for _item in obj["captions"]] if obj.get("captions") is not None else None 181 ), 182 "createdAt": obj.get("createdAt"), 183 "createdBy": CreatedBy.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 184 "endItem": ( 185 ItemConnectionWithLinks.from_dict(obj["endItem"]) if obj.get("endItem") is not None else None 186 ), 187 "id": obj.get("id"), 188 "isSupported": obj.get("isSupported"), 189 "links": SelfLink.from_dict(obj["links"]) if obj.get("links") is not None else None, 190 "modifiedAt": obj.get("modifiedAt"), 191 "modifiedBy": ModifiedBy.from_dict(obj["modifiedBy"]) if obj.get("modifiedBy") is not None else None, 192 "shape": obj.get("shape") if obj.get("shape") is not None else "curved", 193 "startItem": ( 194 ItemConnectionWithLinks.from_dict(obj["startItem"]) if obj.get("startItem") is not None else None 195 ), 196 "style": ConnectorStyle.from_dict(obj["style"]) if obj.get("style") is not None else None, 197 "type": obj.get("type"), 198 } 199 ) 200 # store additional fields in additional_properties 201 for _key in obj.keys(): 202 if _key not in cls.__properties: 203 _obj.additional_properties[_key] = obj.get(_key) 204 205 return _obj
Contains the result data.
84 @field_validator("shape") 85 def shape_validate_enum(cls, value): 86 """Validates the enum""" 87 if value is None: 88 return value 89 90 if value not in set(["straight", "elbowed", "curved"]): 91 raise ValueError("must be one of enum values ('straight', 'elbowed', 'curved')") 92 return value
Validates the enum
100 def to_str(self) -> str: 101 """Returns the string representation of the model using alias""" 102 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
104 def to_json(self) -> str: 105 """Returns the JSON representation of the model using alias""" 106 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 107 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
109 @classmethod 110 def from_json(cls, json_str: str) -> Optional[Self]: 111 """Create an instance of ConnectorWithLinks from a JSON string""" 112 return cls.from_dict(json.loads(json_str))
Create an instance of ConnectorWithLinks from a JSON string
114 def to_dict(self) -> Dict[str, Any]: 115 """Return the dictionary representation of the model using alias. 116 117 This has the following differences from calling pydantic's 118 `self.model_dump(by_alias=True)`: 119 120 * `None` is only added to the output dict for nullable fields that 121 were set at model initialization. Other fields with value `None` 122 are ignored. 123 * Fields in `self.additional_properties` are added to the output dict. 124 """ 125 excluded_fields: Set[str] = set( 126 [ 127 "additional_properties", 128 ] 129 ) 130 131 _dict = self.model_dump( 132 by_alias=True, 133 exclude=excluded_fields, 134 exclude_none=True, 135 ) 136 # override the default output from pydantic by calling `to_dict()` of each item in captions (list) 137 _items = [] 138 if self.captions: 139 for _item in self.captions: 140 if _item: 141 _items.append(_item.to_dict()) 142 _dict["captions"] = _items 143 # override the default output from pydantic by calling `to_dict()` of created_by 144 if self.created_by: 145 _dict["createdBy"] = self.created_by.to_dict() 146 # override the default output from pydantic by calling `to_dict()` of end_item 147 if self.end_item: 148 _dict["endItem"] = self.end_item.to_dict() 149 # override the default output from pydantic by calling `to_dict()` of links 150 if self.links: 151 _dict["links"] = self.links.to_dict() 152 # override the default output from pydantic by calling `to_dict()` of modified_by 153 if self.modified_by: 154 _dict["modifiedBy"] = self.modified_by.to_dict() 155 # override the default output from pydantic by calling `to_dict()` of start_item 156 if self.start_item: 157 _dict["startItem"] = self.start_item.to_dict() 158 # override the default output from pydantic by calling `to_dict()` of style 159 if self.style: 160 _dict["style"] = self.style.to_dict() 161 # puts key-value pairs in additional_properties in the top level 162 if self.additional_properties is not None: 163 for _key, _value in self.additional_properties.items(): 164 _dict[_key] = _value 165 166 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.
168 @classmethod 169 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 170 """Create an instance of ConnectorWithLinks from a dict""" 171 if obj is None: 172 return None 173 174 if not isinstance(obj, dict): 175 return cls.model_validate(obj) 176 177 _obj = cls.model_validate( 178 { 179 "captions": ( 180 [Caption.from_dict(_item) for _item in obj["captions"]] if obj.get("captions") is not None else None 181 ), 182 "createdAt": obj.get("createdAt"), 183 "createdBy": CreatedBy.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 184 "endItem": ( 185 ItemConnectionWithLinks.from_dict(obj["endItem"]) if obj.get("endItem") is not None else None 186 ), 187 "id": obj.get("id"), 188 "isSupported": obj.get("isSupported"), 189 "links": SelfLink.from_dict(obj["links"]) if obj.get("links") is not None else None, 190 "modifiedAt": obj.get("modifiedAt"), 191 "modifiedBy": ModifiedBy.from_dict(obj["modifiedBy"]) if obj.get("modifiedBy") is not None else None, 192 "shape": obj.get("shape") if obj.get("shape") is not None else "curved", 193 "startItem": ( 194 ItemConnectionWithLinks.from_dict(obj["startItem"]) if obj.get("startItem") is not None else None 195 ), 196 "style": ConnectorStyle.from_dict(obj["style"]) if obj.get("style") is not None else None, 197 "type": obj.get("type"), 198 } 199 ) 200 # store additional fields in additional_properties 201 for _key in obj.keys(): 202 if _key not in cls.__properties: 203 _obj.additional_properties[_key] = obj.get(_key) 204 205 return _obj
Create an instance of ConnectorWithLinks 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