miro_api.models.user_resource
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 miro_api.models.user_resource_emails_inner import UserResourceEmailsInner 22from miro_api.models.user_resource_groups_inner import UserResourceGroupsInner 23from miro_api.models.user_resource_meta import UserResourceMeta 24from miro_api.models.user_resource_name import UserResourceName 25from miro_api.models.user_resource_photos_inner import UserResourcePhotosInner 26from miro_api.models.user_resource_roles_inner import UserResourceRolesInner 27from miro_api.models.user_resource_urn_ietf_params_scim_schemas_extension_enterprise20_user import ( 28 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User, 29) 30from typing import Optional, Set 31from typing_extensions import Self 32 33 34class UserResource(BaseModel): 35 """ 36 UserResource 37 """ # noqa: E501 38 39 schemas: Optional[List[StrictStr]] = Field( 40 default=None, 41 description="Identifies which schema(s) this resource uses. In this case it is the SCIM core User schema.", 42 ) 43 id: Optional[StrictStr] = Field(default=None, description="A server-assigned, unique identifier for this user.") 44 meta: Optional[UserResourceMeta] = None 45 user_name: Optional[StrictStr] = Field( 46 default=None, 47 description="The unique username/login identifier. An email address in this case.", 48 alias="userName", 49 ) 50 name: Optional[UserResourceName] = None 51 display_name: Optional[StrictStr] = Field( 52 default=None, description="A human-readable name for the user, typically the full name.", alias="displayName" 53 ) 54 user_type: Optional[StrictStr] = Field( 55 default=None, 56 description="Free-form string to indicate the user license type in the organization.", 57 alias="userType", 58 ) 59 active: Optional[StrictBool] = Field( 60 default=None, description="Indicates whether the user is active or deactivated in the organization." 61 ) 62 emails: Optional[List[UserResourceEmailsInner]] = Field( 63 default=None, description="An array of email addresses, each an object with a value, display and primary flag." 64 ) 65 photos: Optional[List[UserResourcePhotosInner]] = Field( 66 default=None, description="An array for profile pictures, contains type." 67 ) 68 groups: Optional[List[UserResourceGroupsInner]] = Field( 69 default=None, 70 description="An array of groups (teams) the user belongs to in the organization. Contains id and display name of the team.", 71 ) 72 roles: Optional[List[UserResourceRolesInner]] = Field( 73 default=None, 74 description="An array of roles assigned to the user in the organization. Contains role type, value, display and primary flag.", 75 ) 76 preferred_language: Optional[StrictStr] = Field( 77 default=None, 78 description="Specifies the users preferred language. <br><br> Example: en_US for English.", 79 alias="preferredLanguage", 80 ) 81 urnietfparamsscimschemasextensionenterprise2_0_user: Optional[ 82 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User 83 ] = Field(default=None, alias="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User") 84 additional_properties: Dict[str, Any] = {} 85 __properties: ClassVar[List[str]] = [ 86 "schemas", 87 "id", 88 "meta", 89 "userName", 90 "name", 91 "displayName", 92 "userType", 93 "active", 94 "emails", 95 "photos", 96 "groups", 97 "roles", 98 "preferredLanguage", 99 "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", 100 ] 101 102 @field_validator("schemas") 103 def schemas_validate_enum(cls, value): 104 """Validates the enum""" 105 if value is None: 106 return value 107 108 for i in value: 109 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 110 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 111 return value 112 113 model_config = { 114 "populate_by_name": True, 115 "validate_assignment": True, 116 "protected_namespaces": (), 117 } 118 119 def to_str(self) -> str: 120 """Returns the string representation of the model using alias""" 121 return pprint.pformat(self.model_dump(by_alias=True)) 122 123 def to_json(self) -> str: 124 """Returns the JSON representation of the model using alias""" 125 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 126 return json.dumps(self.to_dict()) 127 128 @classmethod 129 def from_json(cls, json_str: str) -> Optional[Self]: 130 """Create an instance of UserResource from a JSON string""" 131 return cls.from_dict(json.loads(json_str)) 132 133 def to_dict(self) -> Dict[str, Any]: 134 """Return the dictionary representation of the model using alias. 135 136 This has the following differences from calling pydantic's 137 `self.model_dump(by_alias=True)`: 138 139 * `None` is only added to the output dict for nullable fields that 140 were set at model initialization. Other fields with value `None` 141 are ignored. 142 * Fields in `self.additional_properties` are added to the output dict. 143 """ 144 excluded_fields: Set[str] = set( 145 [ 146 "additional_properties", 147 ] 148 ) 149 150 _dict = self.model_dump( 151 by_alias=True, 152 exclude=excluded_fields, 153 exclude_none=True, 154 ) 155 # override the default output from pydantic by calling `to_dict()` of meta 156 if self.meta: 157 _dict["meta"] = self.meta.to_dict() 158 # override the default output from pydantic by calling `to_dict()` of name 159 if self.name: 160 _dict["name"] = self.name.to_dict() 161 # override the default output from pydantic by calling `to_dict()` of each item in emails (list) 162 _items = [] 163 if self.emails: 164 for _item in self.emails: 165 if _item: 166 _items.append(_item.to_dict()) 167 _dict["emails"] = _items 168 # override the default output from pydantic by calling `to_dict()` of each item in photos (list) 169 _items = [] 170 if self.photos: 171 for _item in self.photos: 172 if _item: 173 _items.append(_item.to_dict()) 174 _dict["photos"] = _items 175 # override the default output from pydantic by calling `to_dict()` of each item in groups (list) 176 _items = [] 177 if self.groups: 178 for _item in self.groups: 179 if _item: 180 _items.append(_item.to_dict()) 181 _dict["groups"] = _items 182 # override the default output from pydantic by calling `to_dict()` of each item in roles (list) 183 _items = [] 184 if self.roles: 185 for _item in self.roles: 186 if _item: 187 _items.append(_item.to_dict()) 188 _dict["roles"] = _items 189 # override the default output from pydantic by calling `to_dict()` of urnietfparamsscimschemasextensionenterprise2_0_user 190 if self.urnietfparamsscimschemasextensionenterprise2_0_user: 191 _dict["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] = ( 192 self.urnietfparamsscimschemasextensionenterprise2_0_user.to_dict() 193 ) 194 # puts key-value pairs in additional_properties in the top level 195 if self.additional_properties is not None: 196 for _key, _value in self.additional_properties.items(): 197 _dict[_key] = _value 198 199 return _dict 200 201 @classmethod 202 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 203 """Create an instance of UserResource from a dict""" 204 if obj is None: 205 return None 206 207 if not isinstance(obj, dict): 208 return cls.model_validate(obj) 209 210 _obj = cls.model_validate( 211 { 212 "schemas": obj.get("schemas"), 213 "id": obj.get("id"), 214 "meta": UserResourceMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, 215 "userName": obj.get("userName"), 216 "name": UserResourceName.from_dict(obj["name"]) if obj.get("name") is not None else None, 217 "displayName": obj.get("displayName"), 218 "userType": obj.get("userType"), 219 "active": obj.get("active"), 220 "emails": ( 221 [UserResourceEmailsInner.from_dict(_item) for _item in obj["emails"]] 222 if obj.get("emails") is not None 223 else None 224 ), 225 "photos": ( 226 [UserResourcePhotosInner.from_dict(_item) for _item in obj["photos"]] 227 if obj.get("photos") is not None 228 else None 229 ), 230 "groups": ( 231 [UserResourceGroupsInner.from_dict(_item) for _item in obj["groups"]] 232 if obj.get("groups") is not None 233 else None 234 ), 235 "roles": ( 236 [UserResourceRolesInner.from_dict(_item) for _item in obj["roles"]] 237 if obj.get("roles") is not None 238 else None 239 ), 240 "preferredLanguage": obj.get("preferredLanguage"), 241 "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": ( 242 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User.from_dict( 243 obj["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] 244 ) 245 if obj.get("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User") is not None 246 else None 247 ), 248 } 249 ) 250 # store additional fields in additional_properties 251 for _key in obj.keys(): 252 if _key not in cls.__properties: 253 _obj.additional_properties[_key] = obj.get(_key) 254 255 return _obj
35class UserResource(BaseModel): 36 """ 37 UserResource 38 """ # noqa: E501 39 40 schemas: Optional[List[StrictStr]] = Field( 41 default=None, 42 description="Identifies which schema(s) this resource uses. In this case it is the SCIM core User schema.", 43 ) 44 id: Optional[StrictStr] = Field(default=None, description="A server-assigned, unique identifier for this user.") 45 meta: Optional[UserResourceMeta] = None 46 user_name: Optional[StrictStr] = Field( 47 default=None, 48 description="The unique username/login identifier. An email address in this case.", 49 alias="userName", 50 ) 51 name: Optional[UserResourceName] = None 52 display_name: Optional[StrictStr] = Field( 53 default=None, description="A human-readable name for the user, typically the full name.", alias="displayName" 54 ) 55 user_type: Optional[StrictStr] = Field( 56 default=None, 57 description="Free-form string to indicate the user license type in the organization.", 58 alias="userType", 59 ) 60 active: Optional[StrictBool] = Field( 61 default=None, description="Indicates whether the user is active or deactivated in the organization." 62 ) 63 emails: Optional[List[UserResourceEmailsInner]] = Field( 64 default=None, description="An array of email addresses, each an object with a value, display and primary flag." 65 ) 66 photos: Optional[List[UserResourcePhotosInner]] = Field( 67 default=None, description="An array for profile pictures, contains type." 68 ) 69 groups: Optional[List[UserResourceGroupsInner]] = Field( 70 default=None, 71 description="An array of groups (teams) the user belongs to in the organization. Contains id and display name of the team.", 72 ) 73 roles: Optional[List[UserResourceRolesInner]] = Field( 74 default=None, 75 description="An array of roles assigned to the user in the organization. Contains role type, value, display and primary flag.", 76 ) 77 preferred_language: Optional[StrictStr] = Field( 78 default=None, 79 description="Specifies the users preferred language. <br><br> Example: en_US for English.", 80 alias="preferredLanguage", 81 ) 82 urnietfparamsscimschemasextensionenterprise2_0_user: Optional[ 83 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User 84 ] = Field(default=None, alias="urn:ietf:params:scim:schemas:extension:enterprise:2.0:User") 85 additional_properties: Dict[str, Any] = {} 86 __properties: ClassVar[List[str]] = [ 87 "schemas", 88 "id", 89 "meta", 90 "userName", 91 "name", 92 "displayName", 93 "userType", 94 "active", 95 "emails", 96 "photos", 97 "groups", 98 "roles", 99 "preferredLanguage", 100 "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User", 101 ] 102 103 @field_validator("schemas") 104 def schemas_validate_enum(cls, value): 105 """Validates the enum""" 106 if value is None: 107 return value 108 109 for i in value: 110 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 111 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 112 return value 113 114 model_config = { 115 "populate_by_name": True, 116 "validate_assignment": True, 117 "protected_namespaces": (), 118 } 119 120 def to_str(self) -> str: 121 """Returns the string representation of the model using alias""" 122 return pprint.pformat(self.model_dump(by_alias=True)) 123 124 def to_json(self) -> str: 125 """Returns the JSON representation of the model using alias""" 126 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 127 return json.dumps(self.to_dict()) 128 129 @classmethod 130 def from_json(cls, json_str: str) -> Optional[Self]: 131 """Create an instance of UserResource from a JSON string""" 132 return cls.from_dict(json.loads(json_str)) 133 134 def to_dict(self) -> Dict[str, Any]: 135 """Return the dictionary representation of the model using alias. 136 137 This has the following differences from calling pydantic's 138 `self.model_dump(by_alias=True)`: 139 140 * `None` is only added to the output dict for nullable fields that 141 were set at model initialization. Other fields with value `None` 142 are ignored. 143 * Fields in `self.additional_properties` are added to the output dict. 144 """ 145 excluded_fields: Set[str] = set( 146 [ 147 "additional_properties", 148 ] 149 ) 150 151 _dict = self.model_dump( 152 by_alias=True, 153 exclude=excluded_fields, 154 exclude_none=True, 155 ) 156 # override the default output from pydantic by calling `to_dict()` of meta 157 if self.meta: 158 _dict["meta"] = self.meta.to_dict() 159 # override the default output from pydantic by calling `to_dict()` of name 160 if self.name: 161 _dict["name"] = self.name.to_dict() 162 # override the default output from pydantic by calling `to_dict()` of each item in emails (list) 163 _items = [] 164 if self.emails: 165 for _item in self.emails: 166 if _item: 167 _items.append(_item.to_dict()) 168 _dict["emails"] = _items 169 # override the default output from pydantic by calling `to_dict()` of each item in photos (list) 170 _items = [] 171 if self.photos: 172 for _item in self.photos: 173 if _item: 174 _items.append(_item.to_dict()) 175 _dict["photos"] = _items 176 # override the default output from pydantic by calling `to_dict()` of each item in groups (list) 177 _items = [] 178 if self.groups: 179 for _item in self.groups: 180 if _item: 181 _items.append(_item.to_dict()) 182 _dict["groups"] = _items 183 # override the default output from pydantic by calling `to_dict()` of each item in roles (list) 184 _items = [] 185 if self.roles: 186 for _item in self.roles: 187 if _item: 188 _items.append(_item.to_dict()) 189 _dict["roles"] = _items 190 # override the default output from pydantic by calling `to_dict()` of urnietfparamsscimschemasextensionenterprise2_0_user 191 if self.urnietfparamsscimschemasextensionenterprise2_0_user: 192 _dict["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] = ( 193 self.urnietfparamsscimschemasextensionenterprise2_0_user.to_dict() 194 ) 195 # puts key-value pairs in additional_properties in the top level 196 if self.additional_properties is not None: 197 for _key, _value in self.additional_properties.items(): 198 _dict[_key] = _value 199 200 return _dict 201 202 @classmethod 203 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 204 """Create an instance of UserResource from a dict""" 205 if obj is None: 206 return None 207 208 if not isinstance(obj, dict): 209 return cls.model_validate(obj) 210 211 _obj = cls.model_validate( 212 { 213 "schemas": obj.get("schemas"), 214 "id": obj.get("id"), 215 "meta": UserResourceMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, 216 "userName": obj.get("userName"), 217 "name": UserResourceName.from_dict(obj["name"]) if obj.get("name") is not None else None, 218 "displayName": obj.get("displayName"), 219 "userType": obj.get("userType"), 220 "active": obj.get("active"), 221 "emails": ( 222 [UserResourceEmailsInner.from_dict(_item) for _item in obj["emails"]] 223 if obj.get("emails") is not None 224 else None 225 ), 226 "photos": ( 227 [UserResourcePhotosInner.from_dict(_item) for _item in obj["photos"]] 228 if obj.get("photos") is not None 229 else None 230 ), 231 "groups": ( 232 [UserResourceGroupsInner.from_dict(_item) for _item in obj["groups"]] 233 if obj.get("groups") is not None 234 else None 235 ), 236 "roles": ( 237 [UserResourceRolesInner.from_dict(_item) for _item in obj["roles"]] 238 if obj.get("roles") is not None 239 else None 240 ), 241 "preferredLanguage": obj.get("preferredLanguage"), 242 "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": ( 243 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User.from_dict( 244 obj["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] 245 ) 246 if obj.get("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User") is not None 247 else None 248 ), 249 } 250 ) 251 # store additional fields in additional_properties 252 for _key in obj.keys(): 253 if _key not in cls.__properties: 254 _obj.additional_properties[_key] = obj.get(_key) 255 256 return _obj
UserResource
103 @field_validator("schemas") 104 def schemas_validate_enum(cls, value): 105 """Validates the enum""" 106 if value is None: 107 return value 108 109 for i in value: 110 if i not in set(["urn:ietf:params:scim:schemas:core:2.0:User"]): 111 raise ValueError("each list item must be one of ('urn:ietf:params:scim:schemas:core:2.0:User')") 112 return value
Validates the enum
120 def to_str(self) -> str: 121 """Returns the string representation of the model using alias""" 122 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
124 def to_json(self) -> str: 125 """Returns the JSON representation of the model using alias""" 126 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 127 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
129 @classmethod 130 def from_json(cls, json_str: str) -> Optional[Self]: 131 """Create an instance of UserResource from a JSON string""" 132 return cls.from_dict(json.loads(json_str))
Create an instance of UserResource from a JSON string
134 def to_dict(self) -> Dict[str, Any]: 135 """Return the dictionary representation of the model using alias. 136 137 This has the following differences from calling pydantic's 138 `self.model_dump(by_alias=True)`: 139 140 * `None` is only added to the output dict for nullable fields that 141 were set at model initialization. Other fields with value `None` 142 are ignored. 143 * Fields in `self.additional_properties` are added to the output dict. 144 """ 145 excluded_fields: Set[str] = set( 146 [ 147 "additional_properties", 148 ] 149 ) 150 151 _dict = self.model_dump( 152 by_alias=True, 153 exclude=excluded_fields, 154 exclude_none=True, 155 ) 156 # override the default output from pydantic by calling `to_dict()` of meta 157 if self.meta: 158 _dict["meta"] = self.meta.to_dict() 159 # override the default output from pydantic by calling `to_dict()` of name 160 if self.name: 161 _dict["name"] = self.name.to_dict() 162 # override the default output from pydantic by calling `to_dict()` of each item in emails (list) 163 _items = [] 164 if self.emails: 165 for _item in self.emails: 166 if _item: 167 _items.append(_item.to_dict()) 168 _dict["emails"] = _items 169 # override the default output from pydantic by calling `to_dict()` of each item in photos (list) 170 _items = [] 171 if self.photos: 172 for _item in self.photos: 173 if _item: 174 _items.append(_item.to_dict()) 175 _dict["photos"] = _items 176 # override the default output from pydantic by calling `to_dict()` of each item in groups (list) 177 _items = [] 178 if self.groups: 179 for _item in self.groups: 180 if _item: 181 _items.append(_item.to_dict()) 182 _dict["groups"] = _items 183 # override the default output from pydantic by calling `to_dict()` of each item in roles (list) 184 _items = [] 185 if self.roles: 186 for _item in self.roles: 187 if _item: 188 _items.append(_item.to_dict()) 189 _dict["roles"] = _items 190 # override the default output from pydantic by calling `to_dict()` of urnietfparamsscimschemasextensionenterprise2_0_user 191 if self.urnietfparamsscimschemasextensionenterprise2_0_user: 192 _dict["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] = ( 193 self.urnietfparamsscimschemasextensionenterprise2_0_user.to_dict() 194 ) 195 # puts key-value pairs in additional_properties in the top level 196 if self.additional_properties is not None: 197 for _key, _value in self.additional_properties.items(): 198 _dict[_key] = _value 199 200 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):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
202 @classmethod 203 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 204 """Create an instance of UserResource from a dict""" 205 if obj is None: 206 return None 207 208 if not isinstance(obj, dict): 209 return cls.model_validate(obj) 210 211 _obj = cls.model_validate( 212 { 213 "schemas": obj.get("schemas"), 214 "id": obj.get("id"), 215 "meta": UserResourceMeta.from_dict(obj["meta"]) if obj.get("meta") is not None else None, 216 "userName": obj.get("userName"), 217 "name": UserResourceName.from_dict(obj["name"]) if obj.get("name") is not None else None, 218 "displayName": obj.get("displayName"), 219 "userType": obj.get("userType"), 220 "active": obj.get("active"), 221 "emails": ( 222 [UserResourceEmailsInner.from_dict(_item) for _item in obj["emails"]] 223 if obj.get("emails") is not None 224 else None 225 ), 226 "photos": ( 227 [UserResourcePhotosInner.from_dict(_item) for _item in obj["photos"]] 228 if obj.get("photos") is not None 229 else None 230 ), 231 "groups": ( 232 [UserResourceGroupsInner.from_dict(_item) for _item in obj["groups"]] 233 if obj.get("groups") is not None 234 else None 235 ), 236 "roles": ( 237 [UserResourceRolesInner.from_dict(_item) for _item in obj["roles"]] 238 if obj.get("roles") is not None 239 else None 240 ), 241 "preferredLanguage": obj.get("preferredLanguage"), 242 "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": ( 243 UserResourceUrnIetfParamsScimSchemasExtensionEnterprise20User.from_dict( 244 obj["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"] 245 ) 246 if obj.get("urn:ietf:params:scim:schemas:extension:enterprise:2.0:User") is not None 247 else None 248 ), 249 } 250 ) 251 # store additional fields in additional_properties 252 for _key in obj.keys(): 253 if _key not in cls.__properties: 254 _obj.additional_properties[_key] = obj.get(_key) 255 256 return _obj
Create an instance of UserResource 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