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