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