miro_api.models.board_sharing_policy

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 pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator
 20from typing import Any, ClassVar, Dict, List, Optional
 21from typing import Optional, Set
 22from typing_extensions import Self
 23
 24
 25class BoardSharingPolicy(BaseModel):
 26    """
 27    Defines the public-level, organization-level, and team-level access for the board. The access level that a user gets depends on the highest level of access that results from considering the public-level, team-level, organization-level, and direct sharing access.
 28    """  # noqa: E501
 29
 30    access: Optional[StrictStr] = Field(default=None, description="Defines the public-level access to the board.")
 31    access_password_required: Optional[StrictBool] = Field(
 32        default=False,
 33        description="Defines if a password is required to access the board.",
 34        alias="accessPasswordRequired",
 35    )
 36    invite_to_account_and_board_link_access: Optional[StrictStr] = Field(
 37        default="no_access",
 38        description="Defines the user role when inviting a user via the invite to team and board link. For Enterprise users, the `inviteToAccountAndBoardLinkAccess` parameter is always set to `no_access`.",
 39        alias="inviteToAccountAndBoardLinkAccess",
 40    )
 41    organization_access: Optional[StrictStr] = Field(
 42        default="private",
 43        description="Defines the organization-level access to the board. If the board is created for a team that does not belong to an organization, the `organizationAccess` parameter is always set to the default value.",
 44        alias="organizationAccess",
 45    )
 46    team_access: Optional[StrictStr] = Field(
 47        default=None, description="Defines the team-level access to the board.", alias="teamAccess"
 48    )
 49    additional_properties: Dict[str, Any] = {}
 50    __properties: ClassVar[List[str]] = [
 51        "access",
 52        "accessPasswordRequired",
 53        "inviteToAccountAndBoardLinkAccess",
 54        "organizationAccess",
 55        "teamAccess",
 56    ]
 57
 58    @field_validator("access")
 59    def access_validate_enum(cls, value):
 60        """Validates the enum"""
 61        if value is None:
 62            return value
 63
 64        if value not in set(["private", "view", "edit", "comment"]):
 65            raise ValueError("must be one of enum values ('private', 'view', 'edit', 'comment')")
 66        return value
 67
 68    @field_validator("invite_to_account_and_board_link_access")
 69    def invite_to_account_and_board_link_access_validate_enum(cls, value):
 70        """Validates the enum"""
 71        if value is None:
 72            return value
 73
 74        if value not in set(["viewer", "commenter", "editor", "coowner", "owner", "guest", "no_access"]):
 75            raise ValueError(
 76                "must be one of enum values ('viewer', 'commenter', 'editor', 'coowner', 'owner', 'guest', 'no_access')"
 77            )
 78        return value
 79
 80    @field_validator("organization_access")
 81    def organization_access_validate_enum(cls, value):
 82        """Validates the enum"""
 83        if value is None:
 84            return value
 85
 86        if value not in set(["private", "view", "comment", "edit"]):
 87            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
 88        return value
 89
 90    @field_validator("team_access")
 91    def team_access_validate_enum(cls, value):
 92        """Validates the enum"""
 93        if value is None:
 94            return value
 95
 96        if value not in set(["private", "view", "comment", "edit"]):
 97            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
 98        return value
 99
100    model_config = {
101        "populate_by_name": True,
102        "validate_assignment": True,
103        "protected_namespaces": (),
104    }
105
106    def to_str(self) -> str:
107        """Returns the string representation of the model using alias"""
108        return pprint.pformat(self.model_dump(by_alias=True))
109
110    def to_json(self) -> str:
111        """Returns the JSON representation of the model using alias"""
112        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
113        return json.dumps(self.to_dict())
114
115    @classmethod
116    def from_json(cls, json_str: str) -> Optional[Self]:
117        """Create an instance of BoardSharingPolicy from a JSON string"""
118        return cls.from_dict(json.loads(json_str))
119
120    def to_dict(self) -> Dict[str, Any]:
121        """Return the dictionary representation of the model using alias.
122
123        This has the following differences from calling pydantic's
124        `self.model_dump(by_alias=True)`:
125
126        * `None` is only added to the output dict for nullable fields that
127          were set at model initialization. Other fields with value `None`
128          are ignored.
129        * Fields in `self.additional_properties` are added to the output dict.
130        """
131        excluded_fields: Set[str] = set(
132            [
133                "additional_properties",
134            ]
135        )
136
137        _dict = self.model_dump(
138            by_alias=True,
139            exclude=excluded_fields,
140            exclude_none=True,
141        )
142        # puts key-value pairs in additional_properties in the top level
143        if self.additional_properties is not None:
144            for _key, _value in self.additional_properties.items():
145                _dict[_key] = _value
146
147        return _dict
148
149    @classmethod
150    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
151        """Create an instance of BoardSharingPolicy from a dict"""
152        if obj is None:
153            return None
154
155        if not isinstance(obj, dict):
156            return cls.model_validate(obj)
157
158        _obj = cls.model_validate(
159            {
160                "access": obj.get("access"),
161                "accessPasswordRequired": (
162                    obj.get("accessPasswordRequired") if obj.get("accessPasswordRequired") is not None else False
163                ),
164                "inviteToAccountAndBoardLinkAccess": (
165                    obj.get("inviteToAccountAndBoardLinkAccess")
166                    if obj.get("inviteToAccountAndBoardLinkAccess") is not None
167                    else "no_access"
168                ),
169                "organizationAccess": (
170                    obj.get("organizationAccess") if obj.get("organizationAccess") is not None else "private"
171                ),
172                "teamAccess": obj.get("teamAccess"),
173            }
174        )
175        # store additional fields in additional_properties
176        for _key in obj.keys():
177            if _key not in cls.__properties:
178                _obj.additional_properties[_key] = obj.get(_key)
179
180        return _obj
class BoardSharingPolicy(pydantic.main.BaseModel):
 26class BoardSharingPolicy(BaseModel):
 27    """
 28    Defines the public-level, organization-level, and team-level access for the board. The access level that a user gets depends on the highest level of access that results from considering the public-level, team-level, organization-level, and direct sharing access.
 29    """  # noqa: E501
 30
 31    access: Optional[StrictStr] = Field(default=None, description="Defines the public-level access to the board.")
 32    access_password_required: Optional[StrictBool] = Field(
 33        default=False,
 34        description="Defines if a password is required to access the board.",
 35        alias="accessPasswordRequired",
 36    )
 37    invite_to_account_and_board_link_access: Optional[StrictStr] = Field(
 38        default="no_access",
 39        description="Defines the user role when inviting a user via the invite to team and board link. For Enterprise users, the `inviteToAccountAndBoardLinkAccess` parameter is always set to `no_access`.",
 40        alias="inviteToAccountAndBoardLinkAccess",
 41    )
 42    organization_access: Optional[StrictStr] = Field(
 43        default="private",
 44        description="Defines the organization-level access to the board. If the board is created for a team that does not belong to an organization, the `organizationAccess` parameter is always set to the default value.",
 45        alias="organizationAccess",
 46    )
 47    team_access: Optional[StrictStr] = Field(
 48        default=None, description="Defines the team-level access to the board.", alias="teamAccess"
 49    )
 50    additional_properties: Dict[str, Any] = {}
 51    __properties: ClassVar[List[str]] = [
 52        "access",
 53        "accessPasswordRequired",
 54        "inviteToAccountAndBoardLinkAccess",
 55        "organizationAccess",
 56        "teamAccess",
 57    ]
 58
 59    @field_validator("access")
 60    def access_validate_enum(cls, value):
 61        """Validates the enum"""
 62        if value is None:
 63            return value
 64
 65        if value not in set(["private", "view", "edit", "comment"]):
 66            raise ValueError("must be one of enum values ('private', 'view', 'edit', 'comment')")
 67        return value
 68
 69    @field_validator("invite_to_account_and_board_link_access")
 70    def invite_to_account_and_board_link_access_validate_enum(cls, value):
 71        """Validates the enum"""
 72        if value is None:
 73            return value
 74
 75        if value not in set(["viewer", "commenter", "editor", "coowner", "owner", "guest", "no_access"]):
 76            raise ValueError(
 77                "must be one of enum values ('viewer', 'commenter', 'editor', 'coowner', 'owner', 'guest', 'no_access')"
 78            )
 79        return value
 80
 81    @field_validator("organization_access")
 82    def organization_access_validate_enum(cls, value):
 83        """Validates the enum"""
 84        if value is None:
 85            return value
 86
 87        if value not in set(["private", "view", "comment", "edit"]):
 88            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
 89        return value
 90
 91    @field_validator("team_access")
 92    def team_access_validate_enum(cls, value):
 93        """Validates the enum"""
 94        if value is None:
 95            return value
 96
 97        if value not in set(["private", "view", "comment", "edit"]):
 98            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
 99        return value
100
101    model_config = {
102        "populate_by_name": True,
103        "validate_assignment": True,
104        "protected_namespaces": (),
105    }
106
107    def to_str(self) -> str:
108        """Returns the string representation of the model using alias"""
109        return pprint.pformat(self.model_dump(by_alias=True))
110
111    def to_json(self) -> str:
112        """Returns the JSON representation of the model using alias"""
113        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
114        return json.dumps(self.to_dict())
115
116    @classmethod
117    def from_json(cls, json_str: str) -> Optional[Self]:
118        """Create an instance of BoardSharingPolicy from a JSON string"""
119        return cls.from_dict(json.loads(json_str))
120
121    def to_dict(self) -> Dict[str, Any]:
122        """Return the dictionary representation of the model using alias.
123
124        This has the following differences from calling pydantic's
125        `self.model_dump(by_alias=True)`:
126
127        * `None` is only added to the output dict for nullable fields that
128          were set at model initialization. Other fields with value `None`
129          are ignored.
130        * Fields in `self.additional_properties` are added to the output dict.
131        """
132        excluded_fields: Set[str] = set(
133            [
134                "additional_properties",
135            ]
136        )
137
138        _dict = self.model_dump(
139            by_alias=True,
140            exclude=excluded_fields,
141            exclude_none=True,
142        )
143        # puts key-value pairs in additional_properties in the top level
144        if self.additional_properties is not None:
145            for _key, _value in self.additional_properties.items():
146                _dict[_key] = _value
147
148        return _dict
149
150    @classmethod
151    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
152        """Create an instance of BoardSharingPolicy from a dict"""
153        if obj is None:
154            return None
155
156        if not isinstance(obj, dict):
157            return cls.model_validate(obj)
158
159        _obj = cls.model_validate(
160            {
161                "access": obj.get("access"),
162                "accessPasswordRequired": (
163                    obj.get("accessPasswordRequired") if obj.get("accessPasswordRequired") is not None else False
164                ),
165                "inviteToAccountAndBoardLinkAccess": (
166                    obj.get("inviteToAccountAndBoardLinkAccess")
167                    if obj.get("inviteToAccountAndBoardLinkAccess") is not None
168                    else "no_access"
169                ),
170                "organizationAccess": (
171                    obj.get("organizationAccess") if obj.get("organizationAccess") is not None else "private"
172                ),
173                "teamAccess": obj.get("teamAccess"),
174            }
175        )
176        # store additional fields in additional_properties
177        for _key in obj.keys():
178            if _key not in cls.__properties:
179                _obj.additional_properties[_key] = obj.get(_key)
180
181        return _obj

Defines the public-level, organization-level, and team-level access for the board. The access level that a user gets depends on the highest level of access that results from considering the public-level, team-level, organization-level, and direct sharing access.

access: Optional[Annotated[str, Strict(strict=True)]]
access_password_required: Optional[Annotated[bool, Strict(strict=True)]]
organization_access: Optional[Annotated[str, Strict(strict=True)]]
team_access: Optional[Annotated[str, Strict(strict=True)]]
additional_properties: Dict[str, Any]
@field_validator('access')
def access_validate_enum(cls, value):
59    @field_validator("access")
60    def access_validate_enum(cls, value):
61        """Validates the enum"""
62        if value is None:
63            return value
64
65        if value not in set(["private", "view", "edit", "comment"]):
66            raise ValueError("must be one of enum values ('private', 'view', 'edit', 'comment')")
67        return value

Validates the enum

@field_validator('organization_access')
def organization_access_validate_enum(cls, value):
81    @field_validator("organization_access")
82    def organization_access_validate_enum(cls, value):
83        """Validates the enum"""
84        if value is None:
85            return value
86
87        if value not in set(["private", "view", "comment", "edit"]):
88            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
89        return value

Validates the enum

@field_validator('team_access')
def team_access_validate_enum(cls, value):
91    @field_validator("team_access")
92    def team_access_validate_enum(cls, value):
93        """Validates the enum"""
94        if value is None:
95            return value
96
97        if value not in set(["private", "view", "comment", "edit"]):
98            raise ValueError("must be one of enum values ('private', 'view', 'comment', 'edit')")
99        return value

Validates the enum

model_config = {'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': ()}
def to_str(self) -> str:
107    def to_str(self) -> str:
108        """Returns the string representation of the model using alias"""
109        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
111    def to_json(self) -> str:
112        """Returns the JSON representation of the model using alias"""
113        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
114        return json.dumps(self.to_dict())

Returns the JSON representation of the model using alias

@classmethod
def from_json(cls, json_str: str) -> Optional[typing_extensions.Self]:
116    @classmethod
117    def from_json(cls, json_str: str) -> Optional[Self]:
118        """Create an instance of BoardSharingPolicy from a JSON string"""
119        return cls.from_dict(json.loads(json_str))

Create an instance of BoardSharingPolicy from a JSON string

def to_dict(self) -> Dict[str, Any]:
121    def to_dict(self) -> Dict[str, Any]:
122        """Return the dictionary representation of the model using alias.
123
124        This has the following differences from calling pydantic's
125        `self.model_dump(by_alias=True)`:
126
127        * `None` is only added to the output dict for nullable fields that
128          were set at model initialization. Other fields with value `None`
129          are ignored.
130        * Fields in `self.additional_properties` are added to the output dict.
131        """
132        excluded_fields: Set[str] = set(
133            [
134                "additional_properties",
135            ]
136        )
137
138        _dict = self.model_dump(
139            by_alias=True,
140            exclude=excluded_fields,
141            exclude_none=True,
142        )
143        # puts key-value pairs in additional_properties in the top level
144        if self.additional_properties is not None:
145            for _key, _value in self.additional_properties.items():
146                _dict[_key] = _value
147
148        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 value None are ignored.
  • Fields in self.additional_properties are added to the output dict.
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[typing_extensions.Self]:
150    @classmethod
151    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
152        """Create an instance of BoardSharingPolicy from a dict"""
153        if obj is None:
154            return None
155
156        if not isinstance(obj, dict):
157            return cls.model_validate(obj)
158
159        _obj = cls.model_validate(
160            {
161                "access": obj.get("access"),
162                "accessPasswordRequired": (
163                    obj.get("accessPasswordRequired") if obj.get("accessPasswordRequired") is not None else False
164                ),
165                "inviteToAccountAndBoardLinkAccess": (
166                    obj.get("inviteToAccountAndBoardLinkAccess")
167                    if obj.get("inviteToAccountAndBoardLinkAccess") is not None
168                    else "no_access"
169                ),
170                "organizationAccess": (
171                    obj.get("organizationAccess") if obj.get("organizationAccess") is not None else "private"
172                ),
173                "teamAccess": obj.get("teamAccess"),
174            }
175        )
176        # store additional fields in additional_properties
177        for _key in obj.keys():
178            if _key not in cls.__properties:
179                _obj.additional_properties[_key] = obj.get(_key)
180
181        return _obj

Create an instance of BoardSharingPolicy from a dict

def model_post_init(self: pydantic.main.BaseModel, __context: Any) -> None:
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.

model_fields = {'access': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, description='Defines the public-level access to the board.'), 'access_password_required': FieldInfo(annotation=Union[Annotated[bool, Strict(strict=True)], NoneType], required=False, default=False, alias='accessPasswordRequired', alias_priority=2, description='Defines if a password is required to access the board.'), 'invite_to_account_and_board_link_access': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, default='no_access', alias='inviteToAccountAndBoardLinkAccess', alias_priority=2, description='Defines the user role when inviting a user via the invite to team and board link. For Enterprise users, the `inviteToAccountAndBoardLinkAccess` parameter is always set to `no_access`.'), 'organization_access': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, default='private', alias='organizationAccess', alias_priority=2, description='Defines the organization-level access to the board. If the board is created for a team that does not belong to an organization, the `organizationAccess` parameter is always set to the default value.'), 'team_access': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, alias='teamAccess', alias_priority=2, description='Defines the team-level access to the board.'), 'additional_properties': FieldInfo(annotation=Dict[str, Any], required=False, default={})}
model_computed_fields = {}
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