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