miro_api.models.enterprise_get_organization_members200_response
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 json 17import pprint 18from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator 19from typing import Any, List, Optional 20from miro_api.models.organization_member import OrganizationMember 21from miro_api.models.organization_members_search_response import OrganizationMembersSearchResponse 22from pydantic import StrictStr, Field 23from typing import Union, List, Optional, Dict 24from typing_extensions import Literal, Self 25 26ENTERPRISEGETORGANIZATIONMEMBERS200RESPONSE_ONE_OF_SCHEMAS = [ 27 "List[OrganizationMember]", 28 "OrganizationMembersSearchResponse", 29] 30 31 32class EnterpriseGetOrganizationMembers200Response(BaseModel): 33 """ 34 EnterpriseGetOrganizationMembers200Response 35 """ 36 37 # data type: OrganizationMembersSearchResponse 38 oneof_schema_1_validator: Optional[OrganizationMembersSearchResponse] = None 39 # data type: List[OrganizationMember] 40 oneof_schema_2_validator: Optional[List[OrganizationMember]] = Field( 41 default=None, description="Response for search organization members by user emails" 42 ) 43 actual_instance: Optional[Union[List[OrganizationMember], OrganizationMembersSearchResponse]] = None 44 one_of_schemas: List[str] = Field(default=Literal["List[OrganizationMember]", "OrganizationMembersSearchResponse"]) 45 46 model_config = { 47 "validate_assignment": True, 48 "protected_namespaces": (), 49 } 50 51 def __init__(self, *args, **kwargs) -> None: 52 if args: 53 if len(args) > 1: 54 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 55 if kwargs: 56 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 57 super().__init__(actual_instance=args[0]) 58 else: 59 super().__init__(**kwargs) 60 61 def __getattr__(self, attr: str): 62 return getattr(self.actual_instance, attr) 63 64 @field_validator("actual_instance") 65 def actual_instance_must_validate_oneof(cls, v): 66 instance = EnterpriseGetOrganizationMembers200Response.model_construct() 67 error_messages = [] 68 match = 0 69 # validate data type: OrganizationMembersSearchResponse 70 if not isinstance(v, OrganizationMembersSearchResponse): 71 error_messages.append(f"Error! Input type `{type(v)}` is not `OrganizationMembersSearchResponse`") 72 else: 73 match += 1 74 # validate data type: List[OrganizationMember] 75 try: 76 instance.oneof_schema_2_validator = v 77 match += 1 78 except (ValidationError, ValueError) as e: 79 error_messages.append(str(e)) 80 if match > 1: 81 # more than 1 match 82 raise ValueError( 83 "Multiple matches found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 84 + ", ".join(error_messages) 85 ) 86 elif match == 0: 87 # no match 88 raise ValueError( 89 "No match found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 90 + ", ".join(error_messages) 91 ) 92 else: 93 return v 94 95 @classmethod 96 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 97 return cls.from_json(json.dumps(obj)) 98 99 @classmethod 100 def from_json(cls, json_str: str) -> Union[List[OrganizationMember], OrganizationMembersSearchResponse]: 101 """Returns the object represented by the json string""" 102 instance = cls.model_construct() 103 error_messages = [] 104 matches = [] 105 106 # deserialize data into OrganizationMembersSearchResponse 107 try: 108 instance.actual_instance = OrganizationMembersSearchResponse.from_json(json_str) 109 matches.append(instance.actual_instance) 110 except (ValidationError, ValueError) as e: 111 error_messages.append(str(e)) 112 # deserialize data into List[OrganizationMember] 113 try: 114 # validation 115 instance.oneof_schema_2_validator = json.loads(json_str) 116 # assign value to actual_instance 117 instance.actual_instance = instance.oneof_schema_2_validator 118 matches.append(instance.actual_instance) 119 except (ValidationError, ValueError) as e: 120 error_messages.append(str(e)) 121 122 if not matches: 123 # no match 124 raise ValueError( 125 "No match found when deserializing the JSON string into EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 126 + ", ".join(error_messages) 127 ) 128 129 # Return one match that has least additional_properties 130 if len(matches) > 1: 131 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 132 133 return instance 134 135 def to_json(self) -> str: 136 """Returns the JSON representation of the actual instance""" 137 if self.actual_instance is None: 138 return "null" 139 140 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 141 return self.actual_instance.to_json() 142 else: 143 return json.dumps(self.actual_instance) 144 145 def to_dict(self) -> Optional[Union[Dict[str, Any], List[OrganizationMember], OrganizationMembersSearchResponse]]: 146 """Returns the dict representation of the actual instance""" 147 if self.actual_instance is None: 148 return None 149 150 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 151 return self.actual_instance.to_dict() 152 else: 153 # primitive type 154 return self.actual_instance 155 156 def to_str(self) -> str: 157 """Returns the string representation of the actual instance""" 158 return pprint.pformat(self.model_dump())
33class EnterpriseGetOrganizationMembers200Response(BaseModel): 34 """ 35 EnterpriseGetOrganizationMembers200Response 36 """ 37 38 # data type: OrganizationMembersSearchResponse 39 oneof_schema_1_validator: Optional[OrganizationMembersSearchResponse] = None 40 # data type: List[OrganizationMember] 41 oneof_schema_2_validator: Optional[List[OrganizationMember]] = Field( 42 default=None, description="Response for search organization members by user emails" 43 ) 44 actual_instance: Optional[Union[List[OrganizationMember], OrganizationMembersSearchResponse]] = None 45 one_of_schemas: List[str] = Field(default=Literal["List[OrganizationMember]", "OrganizationMembersSearchResponse"]) 46 47 model_config = { 48 "validate_assignment": True, 49 "protected_namespaces": (), 50 } 51 52 def __init__(self, *args, **kwargs) -> None: 53 if args: 54 if len(args) > 1: 55 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 56 if kwargs: 57 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 58 super().__init__(actual_instance=args[0]) 59 else: 60 super().__init__(**kwargs) 61 62 def __getattr__(self, attr: str): 63 return getattr(self.actual_instance, attr) 64 65 @field_validator("actual_instance") 66 def actual_instance_must_validate_oneof(cls, v): 67 instance = EnterpriseGetOrganizationMembers200Response.model_construct() 68 error_messages = [] 69 match = 0 70 # validate data type: OrganizationMembersSearchResponse 71 if not isinstance(v, OrganizationMembersSearchResponse): 72 error_messages.append(f"Error! Input type `{type(v)}` is not `OrganizationMembersSearchResponse`") 73 else: 74 match += 1 75 # validate data type: List[OrganizationMember] 76 try: 77 instance.oneof_schema_2_validator = v 78 match += 1 79 except (ValidationError, ValueError) as e: 80 error_messages.append(str(e)) 81 if match > 1: 82 # more than 1 match 83 raise ValueError( 84 "Multiple matches found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 85 + ", ".join(error_messages) 86 ) 87 elif match == 0: 88 # no match 89 raise ValueError( 90 "No match found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 91 + ", ".join(error_messages) 92 ) 93 else: 94 return v 95 96 @classmethod 97 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 98 return cls.from_json(json.dumps(obj)) 99 100 @classmethod 101 def from_json(cls, json_str: str) -> Union[List[OrganizationMember], OrganizationMembersSearchResponse]: 102 """Returns the object represented by the json string""" 103 instance = cls.model_construct() 104 error_messages = [] 105 matches = [] 106 107 # deserialize data into OrganizationMembersSearchResponse 108 try: 109 instance.actual_instance = OrganizationMembersSearchResponse.from_json(json_str) 110 matches.append(instance.actual_instance) 111 except (ValidationError, ValueError) as e: 112 error_messages.append(str(e)) 113 # deserialize data into List[OrganizationMember] 114 try: 115 # validation 116 instance.oneof_schema_2_validator = json.loads(json_str) 117 # assign value to actual_instance 118 instance.actual_instance = instance.oneof_schema_2_validator 119 matches.append(instance.actual_instance) 120 except (ValidationError, ValueError) as e: 121 error_messages.append(str(e)) 122 123 if not matches: 124 # no match 125 raise ValueError( 126 "No match found when deserializing the JSON string into EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 127 + ", ".join(error_messages) 128 ) 129 130 # Return one match that has least additional_properties 131 if len(matches) > 1: 132 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 133 134 return instance 135 136 def to_json(self) -> str: 137 """Returns the JSON representation of the actual instance""" 138 if self.actual_instance is None: 139 return "null" 140 141 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 142 return self.actual_instance.to_json() 143 else: 144 return json.dumps(self.actual_instance) 145 146 def to_dict(self) -> Optional[Union[Dict[str, Any], List[OrganizationMember], OrganizationMembersSearchResponse]]: 147 """Returns the dict representation of the actual instance""" 148 if self.actual_instance is None: 149 return None 150 151 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 152 return self.actual_instance.to_dict() 153 else: 154 # primitive type 155 return self.actual_instance 156 157 def to_str(self) -> str: 158 """Returns the string representation of the actual instance""" 159 return pprint.pformat(self.model_dump())
EnterpriseGetOrganizationMembers200Response
52 def __init__(self, *args, **kwargs) -> None: 53 if args: 54 if len(args) > 1: 55 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 56 if kwargs: 57 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 58 super().__init__(actual_instance=args[0]) 59 else: 60 super().__init__(**kwargs)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
65 @field_validator("actual_instance") 66 def actual_instance_must_validate_oneof(cls, v): 67 instance = EnterpriseGetOrganizationMembers200Response.model_construct() 68 error_messages = [] 69 match = 0 70 # validate data type: OrganizationMembersSearchResponse 71 if not isinstance(v, OrganizationMembersSearchResponse): 72 error_messages.append(f"Error! Input type `{type(v)}` is not `OrganizationMembersSearchResponse`") 73 else: 74 match += 1 75 # validate data type: List[OrganizationMember] 76 try: 77 instance.oneof_schema_2_validator = v 78 match += 1 79 except (ValidationError, ValueError) as e: 80 error_messages.append(str(e)) 81 if match > 1: 82 # more than 1 match 83 raise ValueError( 84 "Multiple matches found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 85 + ", ".join(error_messages) 86 ) 87 elif match == 0: 88 # no match 89 raise ValueError( 90 "No match found when setting `actual_instance` in EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 91 + ", ".join(error_messages) 92 ) 93 else: 94 return v
100 @classmethod 101 def from_json(cls, json_str: str) -> Union[List[OrganizationMember], OrganizationMembersSearchResponse]: 102 """Returns the object represented by the json string""" 103 instance = cls.model_construct() 104 error_messages = [] 105 matches = [] 106 107 # deserialize data into OrganizationMembersSearchResponse 108 try: 109 instance.actual_instance = OrganizationMembersSearchResponse.from_json(json_str) 110 matches.append(instance.actual_instance) 111 except (ValidationError, ValueError) as e: 112 error_messages.append(str(e)) 113 # deserialize data into List[OrganizationMember] 114 try: 115 # validation 116 instance.oneof_schema_2_validator = json.loads(json_str) 117 # assign value to actual_instance 118 instance.actual_instance = instance.oneof_schema_2_validator 119 matches.append(instance.actual_instance) 120 except (ValidationError, ValueError) as e: 121 error_messages.append(str(e)) 122 123 if not matches: 124 # no match 125 raise ValueError( 126 "No match found when deserializing the JSON string into EnterpriseGetOrganizationMembers200Response with oneOf schemas: List[OrganizationMember], OrganizationMembersSearchResponse. Details: " 127 + ", ".join(error_messages) 128 ) 129 130 # Return one match that has least additional_properties 131 if len(matches) > 1: 132 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 133 134 return instance
Returns the object represented by the json string
136 def to_json(self) -> str: 137 """Returns the JSON representation of the actual instance""" 138 if self.actual_instance is None: 139 return "null" 140 141 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 142 return self.actual_instance.to_json() 143 else: 144 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
146 def to_dict(self) -> Optional[Union[Dict[str, Any], List[OrganizationMember], OrganizationMembersSearchResponse]]: 147 """Returns the dict representation of the actual instance""" 148 if self.actual_instance is None: 149 return None 150 151 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 152 return self.actual_instance.to_dict() 153 else: 154 # primitive type 155 return self.actual_instance
Returns the dict representation of the actual instance
157 def to_str(self) -> str: 158 """Returns the string representation of the actual instance""" 159 return pprint.pformat(self.model_dump())
Returns the string representation of the actual instance
Inherited Members
- pydantic.main.BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- 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