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