miro_api.models.board_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, StrictStr
 22from typing import Any, ClassVar, Dict, List, Optional
 23from miro_api.models.board_links import BoardLinks
 24from miro_api.models.board_member import BoardMember
 25from miro_api.models.board_policy import BoardPolicy
 26from miro_api.models.board_project import BoardProject
 27from miro_api.models.picture import Picture
 28from miro_api.models.team import Team
 29from miro_api.models.user_info_short import UserInfoShort
 30from typing import Optional, Set
 31from typing_extensions import Self
 32
 33
 34class BoardWithLinks(BaseModel):
 35    """
 36    BoardWithLinks
 37    """  # noqa: E501
 38
 39    id: StrictStr = Field(description="Unique identifier (ID) of the board.")
 40    name: StrictStr = Field(description="Name of the board.")
 41    description: StrictStr = Field(description="Description of the board.")
 42    team: Optional[Team] = None
 43    project: Optional[BoardProject] = None
 44    picture: Optional[Picture] = None
 45    policy: Optional[BoardPolicy] = None
 46    view_link: Optional[StrictStr] = Field(default=None, description="URL to view the board.", alias="viewLink")
 47    owner: Optional[UserInfoShort] = None
 48    current_user_membership: Optional[BoardMember] = Field(default=None, alias="currentUserMembership")
 49    created_at: Optional[datetime] = Field(
 50        default=None,
 51        description="Date and time when the board was created. 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)).",
 52        alias="createdAt",
 53    )
 54    created_by: Optional[UserInfoShort] = Field(default=None, alias="createdBy")
 55    modified_at: Optional[datetime] = Field(
 56        default=None,
 57        description="Date and time when the board was last modified. 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[UserInfoShort] = Field(default=None, alias="modifiedBy")
 61    links: Optional[BoardLinks] = None
 62    type: StrictStr = Field(description="Type of the object that is returned. In this case, type returns `board`.")
 63    additional_properties: Dict[str, Any] = {}
 64    __properties: ClassVar[List[str]] = [
 65        "id",
 66        "name",
 67        "description",
 68        "team",
 69        "project",
 70        "picture",
 71        "policy",
 72        "viewLink",
 73        "owner",
 74        "currentUserMembership",
 75        "createdAt",
 76        "createdBy",
 77        "modifiedAt",
 78        "modifiedBy",
 79        "links",
 80        "type",
 81    ]
 82
 83    model_config = {
 84        "populate_by_name": True,
 85        "validate_assignment": True,
 86        "protected_namespaces": (),
 87    }
 88
 89    def to_str(self) -> str:
 90        """Returns the string representation of the model using alias"""
 91        return pprint.pformat(self.model_dump(by_alias=True))
 92
 93    def to_json(self) -> str:
 94        """Returns the JSON representation of the model using alias"""
 95        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 96        return json.dumps(self.to_dict())
 97
 98    @classmethod
 99    def from_json(cls, json_str: str) -> Optional[Self]:
100        """Create an instance of BoardWithLinks from a JSON string"""
101        return cls.from_dict(json.loads(json_str))
102
103    def to_dict(self) -> Dict[str, Any]:
104        """Return the dictionary representation of the model using alias.
105
106        This has the following differences from calling pydantic's
107        `self.model_dump(by_alias=True)`:
108
109        * `None` is only added to the output dict for nullable fields that
110          were set at model initialization. Other fields with value `None`
111          are ignored.
112        * Fields in `self.additional_properties` are added to the output dict.
113        """
114        excluded_fields: Set[str] = set(
115            [
116                "additional_properties",
117            ]
118        )
119
120        _dict = self.model_dump(
121            by_alias=True,
122            exclude=excluded_fields,
123            exclude_none=True,
124        )
125        # override the default output from pydantic by calling `to_dict()` of team
126        if self.team:
127            _dict["team"] = self.team.to_dict()
128        # override the default output from pydantic by calling `to_dict()` of project
129        if self.project:
130            _dict["project"] = self.project.to_dict()
131        # override the default output from pydantic by calling `to_dict()` of picture
132        if self.picture:
133            _dict["picture"] = self.picture.to_dict()
134        # override the default output from pydantic by calling `to_dict()` of policy
135        if self.policy:
136            _dict["policy"] = self.policy.to_dict()
137        # override the default output from pydantic by calling `to_dict()` of owner
138        if self.owner:
139            _dict["owner"] = self.owner.to_dict()
140        # override the default output from pydantic by calling `to_dict()` of current_user_membership
141        if self.current_user_membership:
142            _dict["currentUserMembership"] = self.current_user_membership.to_dict()
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 modified_by
147        if self.modified_by:
148            _dict["modifiedBy"] = self.modified_by.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        # puts key-value pairs in additional_properties in the top level
153        if self.additional_properties is not None:
154            for _key, _value in self.additional_properties.items():
155                _dict[_key] = _value
156
157        return _dict
158
159    @classmethod
160    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
161        """Create an instance of BoardWithLinks from a dict"""
162        if obj is None:
163            return None
164
165        if not isinstance(obj, dict):
166            return cls.model_validate(obj)
167
168        _obj = cls.model_validate(
169            {
170                "id": obj.get("id"),
171                "name": obj.get("name"),
172                "description": obj.get("description"),
173                "team": Team.from_dict(obj["team"]) if obj.get("team") is not None else None,
174                "project": BoardProject.from_dict(obj["project"]) if obj.get("project") is not None else None,
175                "picture": Picture.from_dict(obj["picture"]) if obj.get("picture") is not None else None,
176                "policy": BoardPolicy.from_dict(obj["policy"]) if obj.get("policy") is not None else None,
177                "viewLink": obj.get("viewLink"),
178                "owner": UserInfoShort.from_dict(obj["owner"]) if obj.get("owner") is not None else None,
179                "currentUserMembership": (
180                    BoardMember.from_dict(obj["currentUserMembership"])
181                    if obj.get("currentUserMembership") is not None
182                    else None
183                ),
184                "createdAt": obj.get("createdAt"),
185                "createdBy": UserInfoShort.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None,
186                "modifiedAt": obj.get("modifiedAt"),
187                "modifiedBy": UserInfoShort.from_dict(obj["modifiedBy"]) if obj.get("modifiedBy") is not None else None,
188                "links": BoardLinks.from_dict(obj["links"]) if obj.get("links") is not None else None,
189                "type": obj.get("type"),
190            }
191        )
192        # store additional fields in additional_properties
193        for _key in obj.keys():
194            if _key not in cls.__properties:
195                _obj.additional_properties[_key] = obj.get(_key)
196
197        return _obj