miro_api.models.organization_member

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, StrictBool, StrictStr, field_validator
 21from typing import Any, ClassVar, Dict, List, Optional
 22from miro_api.models.admin_role import AdminRole
 23from typing import Optional, Set
 24from typing_extensions import Self
 25
 26
 27class OrganizationMember(BaseModel):
 28    """
 29    Organization member
 30    """  # noqa: E501
 31
 32    id: StrictStr = Field(description="Id of the user")
 33    active: StrictBool = Field(
 34        description='Indicates if a user is active or deactivated. Learn more about <a target="blank" href="https://help.miro.com/hc/en-us/articles/360025025894-Deactivated-users">user deactivation</a>.'
 35    )
 36    email: StrictStr = Field(description="User email")
 37    last_activity_at: Optional[datetime] = Field(
 38        default=None,
 39        description="Date and time when the user was last active. <br>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)). If the user never logged in, the parameter value is empty. ",
 40        alias="lastActivityAt",
 41    )
 42    license: StrictStr = Field(description="Name of the current user license in the organization")
 43    license_assigned_at: Optional[datetime] = Field(
 44        default=None, description="Time when the license was assigned to the user", alias="licenseAssignedAt"
 45    )
 46    role: StrictStr = Field(description="Name of the user role in the organization")
 47    type: Optional[StrictStr] = Field(default="organization-member", description="Type of the object returned.")
 48    admin_roles: Optional[List[AdminRole]] = Field(
 49        default=None, description="List of admin roles assigned to the user", alias="adminRoles"
 50    )
 51    additional_properties: Dict[str, Any] = {}
 52    __properties: ClassVar[List[str]] = [
 53        "id",
 54        "active",
 55        "email",
 56        "lastActivityAt",
 57        "license",
 58        "licenseAssignedAt",
 59        "role",
 60        "type",
 61        "adminRoles",
 62    ]
 63
 64    @field_validator("license")
 65    def license_validate_enum(cls, value):
 66        """Validates the enum"""
 67        if value not in set(["full", "occasional", "free", "free_restricted", "full_trial", "unknown"]):
 68            raise ValueError(
 69                "must be one of enum values ('full', 'occasional', 'free', 'free_restricted', 'full_trial', 'unknown')"
 70            )
 71        return value
 72
 73    @field_validator("role")
 74    def role_validate_enum(cls, value):
 75        """Validates the enum"""
 76        if value not in set(
 77            [
 78                "organization_internal_admin",
 79                "organization_internal_user",
 80                "organization_external_user",
 81                "organization_team_guest_user",
 82                "unknown",
 83            ]
 84        ):
 85            raise ValueError(
 86                "must be one of enum values ('organization_internal_admin', 'organization_internal_user', 'organization_external_user', 'organization_team_guest_user', 'unknown')"
 87            )
 88        return value
 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 OrganizationMember 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 each item in admin_roles (list)
133        _items = []
134        if self.admin_roles:
135            for _item in self.admin_roles:
136                if _item:
137                    _items.append(_item.to_dict())
138            _dict["adminRoles"] = _items
139        # puts key-value pairs in additional_properties in the top level
140        if self.additional_properties is not None:
141            for _key, _value in self.additional_properties.items():
142                _dict[_key] = _value
143
144        return _dict
145
146    @classmethod
147    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
148        """Create an instance of OrganizationMember from a dict"""
149        if obj is None:
150            return None
151
152        if not isinstance(obj, dict):
153            return cls.model_validate(obj)
154
155        _obj = cls.model_validate(
156            {
157                "id": obj.get("id"),
158                "active": obj.get("active"),
159                "email": obj.get("email"),
160                "lastActivityAt": obj.get("lastActivityAt"),
161                "license": obj.get("license"),
162                "licenseAssignedAt": obj.get("licenseAssignedAt"),
163                "role": obj.get("role"),
164                "type": obj.get("type") if obj.get("type") is not None else "organization-member",
165                "adminRoles": (
166                    [AdminRole.from_dict(_item) for _item in obj["adminRoles"]]
167                    if obj.get("adminRoles") is not None
168                    else None
169                ),
170            }
171        )
172        # store additional fields in additional_properties
173        for _key in obj.keys():
174            if _key not in cls.__properties:
175                _obj.additional_properties[_key] = obj.get(_key)
176
177        return _obj
class OrganizationMember(pydantic.main.BaseModel):
 28class OrganizationMember(BaseModel):
 29    """
 30    Organization member
 31    """  # noqa: E501
 32
 33    id: StrictStr = Field(description="Id of the user")
 34    active: StrictBool = Field(
 35        description='Indicates if a user is active or deactivated. Learn more about <a target="blank" href="https://help.miro.com/hc/en-us/articles/360025025894-Deactivated-users">user deactivation</a>.'
 36    )
 37    email: StrictStr = Field(description="User email")
 38    last_activity_at: Optional[datetime] = Field(
 39        default=None,
 40        description="Date and time when the user was last active. <br>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)). If the user never logged in, the parameter value is empty. ",
 41        alias="lastActivityAt",
 42    )
 43    license: StrictStr = Field(description="Name of the current user license in the organization")
 44    license_assigned_at: Optional[datetime] = Field(
 45        default=None, description="Time when the license was assigned to the user", alias="licenseAssignedAt"
 46    )
 47    role: StrictStr = Field(description="Name of the user role in the organization")
 48    type: Optional[StrictStr] = Field(default="organization-member", description="Type of the object returned.")
 49    admin_roles: Optional[List[AdminRole]] = Field(
 50        default=None, description="List of admin roles assigned to the user", alias="adminRoles"
 51    )
 52    additional_properties: Dict[str, Any] = {}
 53    __properties: ClassVar[List[str]] = [
 54        "id",
 55        "active",
 56        "email",
 57        "lastActivityAt",
 58        "license",
 59        "licenseAssignedAt",
 60        "role",
 61        "type",
 62        "adminRoles",
 63    ]
 64
 65    @field_validator("license")
 66    def license_validate_enum(cls, value):
 67        """Validates the enum"""
 68        if value not in set(["full", "occasional", "free", "free_restricted", "full_trial", "unknown"]):
 69            raise ValueError(
 70                "must be one of enum values ('full', 'occasional', 'free', 'free_restricted', 'full_trial', 'unknown')"
 71            )
 72        return value
 73
 74    @field_validator("role")
 75    def role_validate_enum(cls, value):
 76        """Validates the enum"""
 77        if value not in set(
 78            [
 79                "organization_internal_admin",
 80                "organization_internal_user",
 81                "organization_external_user",
 82                "organization_team_guest_user",
 83                "unknown",
 84            ]
 85        ):
 86            raise ValueError(
 87                "must be one of enum values ('organization_internal_admin', 'organization_internal_user', 'organization_external_user', 'organization_team_guest_user', 'unknown')"
 88            )
 89        return value
 90
 91    model_config = {
 92        "populate_by_name": True,
 93        "validate_assignment": True,
 94        "protected_namespaces": (),
 95    }
 96
 97    def to_str(self) -> str:
 98        """Returns the string representation of the model using alias"""
 99        return pprint.pformat(self.model_dump(by_alias=True))
100
101    def to_json(self) -> str:
102        """Returns the JSON representation of the model using alias"""
103        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
104        return json.dumps(self.to_dict())
105
106    @classmethod
107    def from_json(cls, json_str: str) -> Optional[Self]:
108        """Create an instance of OrganizationMember from a JSON string"""
109        return cls.from_dict(json.loads(json_str))
110
111    def to_dict(self) -> Dict[str, Any]:
112        """Return the dictionary representation of the model using alias.
113
114        This has the following differences from calling pydantic's
115        `self.model_dump(by_alias=True)`:
116
117        * `None` is only added to the output dict for nullable fields that
118          were set at model initialization. Other fields with value `None`
119          are ignored.
120        * Fields in `self.additional_properties` are added to the output dict.
121        """
122        excluded_fields: Set[str] = set(
123            [
124                "additional_properties",
125            ]
126        )
127
128        _dict = self.model_dump(
129            by_alias=True,
130            exclude=excluded_fields,
131            exclude_none=True,
132        )
133        # override the default output from pydantic by calling `to_dict()` of each item in admin_roles (list)
134        _items = []
135        if self.admin_roles:
136            for _item in self.admin_roles:
137                if _item:
138                    _items.append(_item.to_dict())
139            _dict["adminRoles"] = _items
140        # puts key-value pairs in additional_properties in the top level
141        if self.additional_properties is not None:
142            for _key, _value in self.additional_properties.items():
143                _dict[_key] = _value
144
145        return _dict
146
147    @classmethod
148    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
149        """Create an instance of OrganizationMember from a dict"""
150        if obj is None:
151            return None
152
153        if not isinstance(obj, dict):
154            return cls.model_validate(obj)
155
156        _obj = cls.model_validate(
157            {
158                "id": obj.get("id"),
159                "active": obj.get("active"),
160                "email": obj.get("email"),
161                "lastActivityAt": obj.get("lastActivityAt"),
162                "license": obj.get("license"),
163                "licenseAssignedAt": obj.get("licenseAssignedAt"),
164                "role": obj.get("role"),
165                "type": obj.get("type") if obj.get("type") is not None else "organization-member",
166                "adminRoles": (
167                    [AdminRole.from_dict(_item) for _item in obj["adminRoles"]]
168                    if obj.get("adminRoles") is not None
169                    else None
170                ),
171            }
172        )
173        # store additional fields in additional_properties
174        for _key in obj.keys():
175            if _key not in cls.__properties:
176                _obj.additional_properties[_key] = obj.get(_key)
177
178        return _obj

Organization member

id: typing.Annotated[str, Strict(strict=True)]
active: typing.Annotated[bool, Strict(strict=True)]
email: typing.Annotated[str, Strict(strict=True)]
last_activity_at: Optional[datetime.datetime]
license: typing.Annotated[str, Strict(strict=True)]
license_assigned_at: Optional[datetime.datetime]
role: typing.Annotated[str, Strict(strict=True)]
type: Optional[Annotated[str, Strict(strict=True)]]
admin_roles: Optional[List[miro_api.models.admin_role.AdminRole]]
additional_properties: Dict[str, Any]
@field_validator('license')
def license_validate_enum(cls, value):
65    @field_validator("license")
66    def license_validate_enum(cls, value):
67        """Validates the enum"""
68        if value not in set(["full", "occasional", "free", "free_restricted", "full_trial", "unknown"]):
69            raise ValueError(
70                "must be one of enum values ('full', 'occasional', 'free', 'free_restricted', 'full_trial', 'unknown')"
71            )
72        return value

Validates the enum

@field_validator('role')
def role_validate_enum(cls, value):
74    @field_validator("role")
75    def role_validate_enum(cls, value):
76        """Validates the enum"""
77        if value not in set(
78            [
79                "organization_internal_admin",
80                "organization_internal_user",
81                "organization_external_user",
82                "organization_team_guest_user",
83                "unknown",
84            ]
85        ):
86            raise ValueError(
87                "must be one of enum values ('organization_internal_admin', 'organization_internal_user', 'organization_external_user', 'organization_team_guest_user', 'unknown')"
88            )
89        return value

Validates the enum

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

Returns the string representation of the model using alias

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

Create an instance of OrganizationMember from a JSON string

def to_dict(self) -> Dict[str, Any]:
111    def to_dict(self) -> Dict[str, Any]:
112        """Return the dictionary representation of the model using alias.
113
114        This has the following differences from calling pydantic's
115        `self.model_dump(by_alias=True)`:
116
117        * `None` is only added to the output dict for nullable fields that
118          were set at model initialization. Other fields with value `None`
119          are ignored.
120        * Fields in `self.additional_properties` are added to the output dict.
121        """
122        excluded_fields: Set[str] = set(
123            [
124                "additional_properties",
125            ]
126        )
127
128        _dict = self.model_dump(
129            by_alias=True,
130            exclude=excluded_fields,
131            exclude_none=True,
132        )
133        # override the default output from pydantic by calling `to_dict()` of each item in admin_roles (list)
134        _items = []
135        if self.admin_roles:
136            for _item in self.admin_roles:
137                if _item:
138                    _items.append(_item.to_dict())
139            _dict["adminRoles"] = _items
140        # puts key-value pairs in additional_properties in the top level
141        if self.additional_properties is not None:
142            for _key, _value in self.additional_properties.items():
143                _dict[_key] = _value
144
145        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]:
147    @classmethod
148    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
149        """Create an instance of OrganizationMember from a dict"""
150        if obj is None:
151            return None
152
153        if not isinstance(obj, dict):
154            return cls.model_validate(obj)
155
156        _obj = cls.model_validate(
157            {
158                "id": obj.get("id"),
159                "active": obj.get("active"),
160                "email": obj.get("email"),
161                "lastActivityAt": obj.get("lastActivityAt"),
162                "license": obj.get("license"),
163                "licenseAssignedAt": obj.get("licenseAssignedAt"),
164                "role": obj.get("role"),
165                "type": obj.get("type") if obj.get("type") is not None else "organization-member",
166                "adminRoles": (
167                    [AdminRole.from_dict(_item) for _item in obj["adminRoles"]]
168                    if obj.get("adminRoles") is not None
169                    else None
170                ),
171            }
172        )
173        # store additional fields in additional_properties
174        for _key in obj.keys():
175            if _key not in cls.__properties:
176                _obj.additional_properties[_key] = obj.get(_key)
177
178        return _obj

Create an instance of OrganizationMember 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 = {'id': FieldInfo(annotation=str, required=True, description='Id of the user', metadata=[Strict(strict=True)]), 'active': FieldInfo(annotation=bool, required=True, description='Indicates if a user is active or deactivated. Learn more about <a target="blank" href="https://help.miro.com/hc/en-us/articles/360025025894-Deactivated-users">user deactivation</a>.', metadata=[Strict(strict=True)]), 'email': FieldInfo(annotation=str, required=True, description='User email', metadata=[Strict(strict=True)]), 'last_activity_at': FieldInfo(annotation=Union[datetime, NoneType], required=False, alias='lastActivityAt', alias_priority=2, description='Date and time when the user was last active. <br>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)). If the user never logged in, the parameter value is empty. '), 'license': FieldInfo(annotation=str, required=True, description='Name of the current user license in the organization', metadata=[Strict(strict=True)]), 'license_assigned_at': FieldInfo(annotation=Union[datetime, NoneType], required=False, alias='licenseAssignedAt', alias_priority=2, description='Time when the license was assigned to the user'), 'role': FieldInfo(annotation=str, required=True, description='Name of the user role in the organization', metadata=[Strict(strict=True)]), 'type': FieldInfo(annotation=Union[Annotated[str, Strict(strict=True)], NoneType], required=False, default='organization-member', description='Type of the object returned.'), 'admin_roles': FieldInfo(annotation=Union[List[miro_api.models.admin_role.AdminRole], NoneType], required=False, alias='adminRoles', alias_priority=2, description='List of admin roles assigned to the user'), '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