miro_api.models.board_sharing_policy_change

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

Validates the enum

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

Validates the enum

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

Validates the enum

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

Returns the string representation of the model using alias

def to_json(self) -> str:
106    def to_json(self) -> str:
107        """Returns the JSON representation of the model using alias"""
108        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
109        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]:
111    @classmethod
112    def from_json(cls, json_str: str) -> Optional[Self]:
113        """Create an instance of BoardSharingPolicyChange from a JSON string"""
114        return cls.from_dict(json.loads(json_str))

Create an instance of BoardSharingPolicyChange from a JSON string

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

Create an instance of BoardSharingPolicyChange 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, default='private', description='Defines the public-level access to 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` regardless of the value that you assign for this parameter.'), '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. By default, **edit** for the free plan and **private** for other plans.'), '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