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