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