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

EnterpriseGetOrganizationMembers200Response

EnterpriseGetOrganizationMembers200Response(*args, **kwargs)
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)

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.

oneof_schema_2_validator: Optional[List[miro_api.models.organization_member.OrganizationMember]]
one_of_schemas: List[str]
model_config = {'validate_assignment': True, 'protected_namespaces': ()}
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
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
@classmethod
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> typing_extensions.Self:
95    @classmethod
96    def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
97        return cls.from_json(json.dumps(obj))
 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

Returns the object represented by the json string

def to_json(self) -> str:
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)

Returns the JSON representation of the actual instance

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

Returns the dict representation of the actual instance

def to_str(self) -> str:
156    def to_str(self) -> str:
157        """Returns the string representation of the actual instance"""
158        return pprint.pformat(self.model_dump())

Returns the string representation of the actual instance

model_fields = {'oneof_schema_1_validator': FieldInfo(annotation=Union[OrganizationMembersSearchResponse, NoneType], required=False), 'oneof_schema_2_validator': FieldInfo(annotation=Union[List[miro_api.models.organization_member.OrganizationMember], NoneType], required=False, description='Response for search organization members by user emails'), 'actual_instance': FieldInfo(annotation=Union[List[miro_api.models.organization_member.OrganizationMember], OrganizationMembersSearchResponse, NoneType], required=False), 'one_of_schemas': FieldInfo(annotation=List[str], required=False, default=typing_extensions.Literal['List[OrganizationMember]', 'OrganizationMembersSearchResponse'])}
model_computed_fields = {}
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