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