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