miro_api.models.item_data_platformcreateitemsinbulkusingfilefromdevice
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.app_card_data_response import AppCardDataResponse 21from miro_api.models.card_data import CardData 22from miro_api.models.document_data_response import DocumentDataResponse 23from miro_api.models.embed_data_response import EmbedDataResponse 24from miro_api.models.image_data_response import ImageDataResponse 25from miro_api.models.shape_data import ShapeData 26from miro_api.models.sticky_note_data import StickyNoteData 27from miro_api.models.text_data import TextData 28from pydantic import StrictStr, Field 29from typing import Union, List, Optional, Dict 30from typing_extensions import Literal, Self 31 32ITEMDATAPLATFORMCREATEITEMSINBULKUSINGFILEFROMDEVICE_ONE_OF_SCHEMAS = [ 33 "AppCardDataResponse", 34 "CardData", 35 "DocumentDataResponse", 36 "EmbedDataResponse", 37 "ImageDataResponse", 38 "ShapeData", 39 "StickyNoteData", 40 "TextData", 41] 42 43 44class ItemDataPlatformcreateitemsinbulkusingfilefromdevice(BaseModel): 45 """ 46 Contains information about item-specific data. 47 """ 48 49 # data type: AppCardDataResponse 50 oneof_schema_1_validator: Optional[AppCardDataResponse] = None 51 # data type: CardData 52 oneof_schema_2_validator: Optional[CardData] = None 53 # data type: DocumentDataResponse 54 oneof_schema_3_validator: Optional[DocumentDataResponse] = None 55 # data type: EmbedDataResponse 56 oneof_schema_4_validator: Optional[EmbedDataResponse] = None 57 # data type: ImageDataResponse 58 oneof_schema_5_validator: Optional[ImageDataResponse] = None 59 # data type: ShapeData 60 oneof_schema_6_validator: Optional[ShapeData] = None 61 # data type: StickyNoteData 62 oneof_schema_7_validator: Optional[StickyNoteData] = None 63 # data type: TextData 64 oneof_schema_8_validator: Optional[TextData] = None 65 actual_instance: Optional[ 66 Union[ 67 AppCardDataResponse, 68 CardData, 69 DocumentDataResponse, 70 EmbedDataResponse, 71 ImageDataResponse, 72 ShapeData, 73 StickyNoteData, 74 TextData, 75 ] 76 ] = None 77 one_of_schemas: List[str] = Field( 78 default=Literal[ 79 "AppCardDataResponse", 80 "CardData", 81 "DocumentDataResponse", 82 "EmbedDataResponse", 83 "ImageDataResponse", 84 "ShapeData", 85 "StickyNoteData", 86 "TextData", 87 ] 88 ) 89 90 model_config = { 91 "validate_assignment": True, 92 "protected_namespaces": (), 93 } 94 95 def __init__(self, *args, **kwargs) -> None: 96 if args: 97 if len(args) > 1: 98 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 99 if kwargs: 100 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 101 super().__init__(actual_instance=args[0]) 102 else: 103 super().__init__(**kwargs) 104 105 def __getattr__(self, attr: str): 106 return getattr(self.actual_instance, attr) 107 108 @field_validator("actual_instance") 109 def actual_instance_must_validate_oneof(cls, v): 110 instance = ItemDataPlatformcreateitemsinbulkusingfilefromdevice.model_construct() 111 error_messages = [] 112 match = 0 113 # validate data type: AppCardDataResponse 114 if not isinstance(v, AppCardDataResponse): 115 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardDataResponse`") 116 else: 117 match += 1 118 # validate data type: CardData 119 if not isinstance(v, CardData): 120 error_messages.append(f"Error! Input type `{type(v)}` is not `CardData`") 121 else: 122 match += 1 123 # validate data type: DocumentDataResponse 124 if not isinstance(v, DocumentDataResponse): 125 error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentDataResponse`") 126 else: 127 match += 1 128 # validate data type: EmbedDataResponse 129 if not isinstance(v, EmbedDataResponse): 130 error_messages.append(f"Error! Input type `{type(v)}` is not `EmbedDataResponse`") 131 else: 132 match += 1 133 # validate data type: ImageDataResponse 134 if not isinstance(v, ImageDataResponse): 135 error_messages.append(f"Error! Input type `{type(v)}` is not `ImageDataResponse`") 136 else: 137 match += 1 138 # validate data type: ShapeData 139 if not isinstance(v, ShapeData): 140 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeData`") 141 else: 142 match += 1 143 # validate data type: StickyNoteData 144 if not isinstance(v, StickyNoteData): 145 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteData`") 146 else: 147 match += 1 148 # validate data type: TextData 149 if not isinstance(v, TextData): 150 error_messages.append(f"Error! Input type `{type(v)}` is not `TextData`") 151 else: 152 match += 1 153 if match > 1: 154 # more than 1 match 155 raise ValueError( 156 "Multiple matches found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 157 + ", ".join(error_messages) 158 ) 159 elif match == 0: 160 # no match 161 raise ValueError( 162 "No match found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 163 + ", ".join(error_messages) 164 ) 165 else: 166 return v 167 168 @classmethod 169 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 170 return cls.from_json(json.dumps(obj)) 171 172 @classmethod 173 def from_json(cls, json_str: str) -> Union[ 174 AppCardDataResponse, 175 CardData, 176 DocumentDataResponse, 177 EmbedDataResponse, 178 ImageDataResponse, 179 ShapeData, 180 StickyNoteData, 181 TextData, 182 ]: 183 """Returns the object represented by the json string""" 184 instance = cls.model_construct() 185 error_messages = [] 186 matches = [] 187 188 # deserialize data into AppCardDataResponse 189 try: 190 instance.actual_instance = AppCardDataResponse.from_json(json_str) 191 matches.append(instance.actual_instance) 192 except (ValidationError, ValueError) as e: 193 error_messages.append(str(e)) 194 # deserialize data into CardData 195 try: 196 instance.actual_instance = CardData.from_json(json_str) 197 matches.append(instance.actual_instance) 198 except (ValidationError, ValueError) as e: 199 error_messages.append(str(e)) 200 # deserialize data into DocumentDataResponse 201 try: 202 instance.actual_instance = DocumentDataResponse.from_json(json_str) 203 matches.append(instance.actual_instance) 204 except (ValidationError, ValueError) as e: 205 error_messages.append(str(e)) 206 # deserialize data into EmbedDataResponse 207 try: 208 instance.actual_instance = EmbedDataResponse.from_json(json_str) 209 matches.append(instance.actual_instance) 210 except (ValidationError, ValueError) as e: 211 error_messages.append(str(e)) 212 # deserialize data into ImageDataResponse 213 try: 214 instance.actual_instance = ImageDataResponse.from_json(json_str) 215 matches.append(instance.actual_instance) 216 except (ValidationError, ValueError) as e: 217 error_messages.append(str(e)) 218 # deserialize data into ShapeData 219 try: 220 instance.actual_instance = ShapeData.from_json(json_str) 221 matches.append(instance.actual_instance) 222 except (ValidationError, ValueError) as e: 223 error_messages.append(str(e)) 224 # deserialize data into StickyNoteData 225 try: 226 instance.actual_instance = StickyNoteData.from_json(json_str) 227 matches.append(instance.actual_instance) 228 except (ValidationError, ValueError) as e: 229 error_messages.append(str(e)) 230 # deserialize data into TextData 231 try: 232 instance.actual_instance = TextData.from_json(json_str) 233 matches.append(instance.actual_instance) 234 except (ValidationError, ValueError) as e: 235 error_messages.append(str(e)) 236 237 if not matches: 238 # no match 239 raise ValueError( 240 "No match found when deserializing the JSON string into ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 241 + ", ".join(error_messages) 242 ) 243 244 # Return one match that has least additional_properties 245 if len(matches) > 1: 246 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 247 248 return instance 249 250 def to_json(self) -> str: 251 """Returns the JSON representation of the actual instance""" 252 if self.actual_instance is None: 253 return "null" 254 255 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 256 return self.actual_instance.to_json() 257 else: 258 return json.dumps(self.actual_instance) 259 260 def to_dict( 261 self, 262 ) -> Optional[ 263 Union[ 264 Dict[str, Any], 265 AppCardDataResponse, 266 CardData, 267 DocumentDataResponse, 268 EmbedDataResponse, 269 ImageDataResponse, 270 ShapeData, 271 StickyNoteData, 272 TextData, 273 ] 274 ]: 275 """Returns the dict representation of the actual instance""" 276 if self.actual_instance is None: 277 return None 278 279 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 280 return self.actual_instance.to_dict() 281 else: 282 # primitive type 283 return self.actual_instance 284 285 def to_str(self) -> str: 286 """Returns the string representation of the actual instance""" 287 return pprint.pformat(self.model_dump())
45class ItemDataPlatformcreateitemsinbulkusingfilefromdevice(BaseModel): 46 """ 47 Contains information about item-specific data. 48 """ 49 50 # data type: AppCardDataResponse 51 oneof_schema_1_validator: Optional[AppCardDataResponse] = None 52 # data type: CardData 53 oneof_schema_2_validator: Optional[CardData] = None 54 # data type: DocumentDataResponse 55 oneof_schema_3_validator: Optional[DocumentDataResponse] = None 56 # data type: EmbedDataResponse 57 oneof_schema_4_validator: Optional[EmbedDataResponse] = None 58 # data type: ImageDataResponse 59 oneof_schema_5_validator: Optional[ImageDataResponse] = None 60 # data type: ShapeData 61 oneof_schema_6_validator: Optional[ShapeData] = None 62 # data type: StickyNoteData 63 oneof_schema_7_validator: Optional[StickyNoteData] = None 64 # data type: TextData 65 oneof_schema_8_validator: Optional[TextData] = None 66 actual_instance: Optional[ 67 Union[ 68 AppCardDataResponse, 69 CardData, 70 DocumentDataResponse, 71 EmbedDataResponse, 72 ImageDataResponse, 73 ShapeData, 74 StickyNoteData, 75 TextData, 76 ] 77 ] = None 78 one_of_schemas: List[str] = Field( 79 default=Literal[ 80 "AppCardDataResponse", 81 "CardData", 82 "DocumentDataResponse", 83 "EmbedDataResponse", 84 "ImageDataResponse", 85 "ShapeData", 86 "StickyNoteData", 87 "TextData", 88 ] 89 ) 90 91 model_config = { 92 "validate_assignment": True, 93 "protected_namespaces": (), 94 } 95 96 def __init__(self, *args, **kwargs) -> None: 97 if args: 98 if len(args) > 1: 99 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 100 if kwargs: 101 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 102 super().__init__(actual_instance=args[0]) 103 else: 104 super().__init__(**kwargs) 105 106 def __getattr__(self, attr: str): 107 return getattr(self.actual_instance, attr) 108 109 @field_validator("actual_instance") 110 def actual_instance_must_validate_oneof(cls, v): 111 instance = ItemDataPlatformcreateitemsinbulkusingfilefromdevice.model_construct() 112 error_messages = [] 113 match = 0 114 # validate data type: AppCardDataResponse 115 if not isinstance(v, AppCardDataResponse): 116 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardDataResponse`") 117 else: 118 match += 1 119 # validate data type: CardData 120 if not isinstance(v, CardData): 121 error_messages.append(f"Error! Input type `{type(v)}` is not `CardData`") 122 else: 123 match += 1 124 # validate data type: DocumentDataResponse 125 if not isinstance(v, DocumentDataResponse): 126 error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentDataResponse`") 127 else: 128 match += 1 129 # validate data type: EmbedDataResponse 130 if not isinstance(v, EmbedDataResponse): 131 error_messages.append(f"Error! Input type `{type(v)}` is not `EmbedDataResponse`") 132 else: 133 match += 1 134 # validate data type: ImageDataResponse 135 if not isinstance(v, ImageDataResponse): 136 error_messages.append(f"Error! Input type `{type(v)}` is not `ImageDataResponse`") 137 else: 138 match += 1 139 # validate data type: ShapeData 140 if not isinstance(v, ShapeData): 141 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeData`") 142 else: 143 match += 1 144 # validate data type: StickyNoteData 145 if not isinstance(v, StickyNoteData): 146 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteData`") 147 else: 148 match += 1 149 # validate data type: TextData 150 if not isinstance(v, TextData): 151 error_messages.append(f"Error! Input type `{type(v)}` is not `TextData`") 152 else: 153 match += 1 154 if match > 1: 155 # more than 1 match 156 raise ValueError( 157 "Multiple matches found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 158 + ", ".join(error_messages) 159 ) 160 elif match == 0: 161 # no match 162 raise ValueError( 163 "No match found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 164 + ", ".join(error_messages) 165 ) 166 else: 167 return v 168 169 @classmethod 170 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 171 return cls.from_json(json.dumps(obj)) 172 173 @classmethod 174 def from_json(cls, json_str: str) -> Union[ 175 AppCardDataResponse, 176 CardData, 177 DocumentDataResponse, 178 EmbedDataResponse, 179 ImageDataResponse, 180 ShapeData, 181 StickyNoteData, 182 TextData, 183 ]: 184 """Returns the object represented by the json string""" 185 instance = cls.model_construct() 186 error_messages = [] 187 matches = [] 188 189 # deserialize data into AppCardDataResponse 190 try: 191 instance.actual_instance = AppCardDataResponse.from_json(json_str) 192 matches.append(instance.actual_instance) 193 except (ValidationError, ValueError) as e: 194 error_messages.append(str(e)) 195 # deserialize data into CardData 196 try: 197 instance.actual_instance = CardData.from_json(json_str) 198 matches.append(instance.actual_instance) 199 except (ValidationError, ValueError) as e: 200 error_messages.append(str(e)) 201 # deserialize data into DocumentDataResponse 202 try: 203 instance.actual_instance = DocumentDataResponse.from_json(json_str) 204 matches.append(instance.actual_instance) 205 except (ValidationError, ValueError) as e: 206 error_messages.append(str(e)) 207 # deserialize data into EmbedDataResponse 208 try: 209 instance.actual_instance = EmbedDataResponse.from_json(json_str) 210 matches.append(instance.actual_instance) 211 except (ValidationError, ValueError) as e: 212 error_messages.append(str(e)) 213 # deserialize data into ImageDataResponse 214 try: 215 instance.actual_instance = ImageDataResponse.from_json(json_str) 216 matches.append(instance.actual_instance) 217 except (ValidationError, ValueError) as e: 218 error_messages.append(str(e)) 219 # deserialize data into ShapeData 220 try: 221 instance.actual_instance = ShapeData.from_json(json_str) 222 matches.append(instance.actual_instance) 223 except (ValidationError, ValueError) as e: 224 error_messages.append(str(e)) 225 # deserialize data into StickyNoteData 226 try: 227 instance.actual_instance = StickyNoteData.from_json(json_str) 228 matches.append(instance.actual_instance) 229 except (ValidationError, ValueError) as e: 230 error_messages.append(str(e)) 231 # deserialize data into TextData 232 try: 233 instance.actual_instance = TextData.from_json(json_str) 234 matches.append(instance.actual_instance) 235 except (ValidationError, ValueError) as e: 236 error_messages.append(str(e)) 237 238 if not matches: 239 # no match 240 raise ValueError( 241 "No match found when deserializing the JSON string into ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 242 + ", ".join(error_messages) 243 ) 244 245 # Return one match that has least additional_properties 246 if len(matches) > 1: 247 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 248 249 return instance 250 251 def to_json(self) -> str: 252 """Returns the JSON representation of the actual instance""" 253 if self.actual_instance is None: 254 return "null" 255 256 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 257 return self.actual_instance.to_json() 258 else: 259 return json.dumps(self.actual_instance) 260 261 def to_dict( 262 self, 263 ) -> Optional[ 264 Union[ 265 Dict[str, Any], 266 AppCardDataResponse, 267 CardData, 268 DocumentDataResponse, 269 EmbedDataResponse, 270 ImageDataResponse, 271 ShapeData, 272 StickyNoteData, 273 TextData, 274 ] 275 ]: 276 """Returns the dict representation of the actual instance""" 277 if self.actual_instance is None: 278 return None 279 280 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 281 return self.actual_instance.to_dict() 282 else: 283 # primitive type 284 return self.actual_instance 285 286 def to_str(self) -> str: 287 """Returns the string representation of the actual instance""" 288 return pprint.pformat(self.model_dump())
Contains information about item-specific data.
96 def __init__(self, *args, **kwargs) -> None: 97 if args: 98 if len(args) > 1: 99 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 100 if kwargs: 101 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 102 super().__init__(actual_instance=args[0]) 103 else: 104 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.
109 @field_validator("actual_instance") 110 def actual_instance_must_validate_oneof(cls, v): 111 instance = ItemDataPlatformcreateitemsinbulkusingfilefromdevice.model_construct() 112 error_messages = [] 113 match = 0 114 # validate data type: AppCardDataResponse 115 if not isinstance(v, AppCardDataResponse): 116 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardDataResponse`") 117 else: 118 match += 1 119 # validate data type: CardData 120 if not isinstance(v, CardData): 121 error_messages.append(f"Error! Input type `{type(v)}` is not `CardData`") 122 else: 123 match += 1 124 # validate data type: DocumentDataResponse 125 if not isinstance(v, DocumentDataResponse): 126 error_messages.append(f"Error! Input type `{type(v)}` is not `DocumentDataResponse`") 127 else: 128 match += 1 129 # validate data type: EmbedDataResponse 130 if not isinstance(v, EmbedDataResponse): 131 error_messages.append(f"Error! Input type `{type(v)}` is not `EmbedDataResponse`") 132 else: 133 match += 1 134 # validate data type: ImageDataResponse 135 if not isinstance(v, ImageDataResponse): 136 error_messages.append(f"Error! Input type `{type(v)}` is not `ImageDataResponse`") 137 else: 138 match += 1 139 # validate data type: ShapeData 140 if not isinstance(v, ShapeData): 141 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeData`") 142 else: 143 match += 1 144 # validate data type: StickyNoteData 145 if not isinstance(v, StickyNoteData): 146 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteData`") 147 else: 148 match += 1 149 # validate data type: TextData 150 if not isinstance(v, TextData): 151 error_messages.append(f"Error! Input type `{type(v)}` is not `TextData`") 152 else: 153 match += 1 154 if match > 1: 155 # more than 1 match 156 raise ValueError( 157 "Multiple matches found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 158 + ", ".join(error_messages) 159 ) 160 elif match == 0: 161 # no match 162 raise ValueError( 163 "No match found when setting `actual_instance` in ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 164 + ", ".join(error_messages) 165 ) 166 else: 167 return v
173 @classmethod 174 def from_json(cls, json_str: str) -> Union[ 175 AppCardDataResponse, 176 CardData, 177 DocumentDataResponse, 178 EmbedDataResponse, 179 ImageDataResponse, 180 ShapeData, 181 StickyNoteData, 182 TextData, 183 ]: 184 """Returns the object represented by the json string""" 185 instance = cls.model_construct() 186 error_messages = [] 187 matches = [] 188 189 # deserialize data into AppCardDataResponse 190 try: 191 instance.actual_instance = AppCardDataResponse.from_json(json_str) 192 matches.append(instance.actual_instance) 193 except (ValidationError, ValueError) as e: 194 error_messages.append(str(e)) 195 # deserialize data into CardData 196 try: 197 instance.actual_instance = CardData.from_json(json_str) 198 matches.append(instance.actual_instance) 199 except (ValidationError, ValueError) as e: 200 error_messages.append(str(e)) 201 # deserialize data into DocumentDataResponse 202 try: 203 instance.actual_instance = DocumentDataResponse.from_json(json_str) 204 matches.append(instance.actual_instance) 205 except (ValidationError, ValueError) as e: 206 error_messages.append(str(e)) 207 # deserialize data into EmbedDataResponse 208 try: 209 instance.actual_instance = EmbedDataResponse.from_json(json_str) 210 matches.append(instance.actual_instance) 211 except (ValidationError, ValueError) as e: 212 error_messages.append(str(e)) 213 # deserialize data into ImageDataResponse 214 try: 215 instance.actual_instance = ImageDataResponse.from_json(json_str) 216 matches.append(instance.actual_instance) 217 except (ValidationError, ValueError) as e: 218 error_messages.append(str(e)) 219 # deserialize data into ShapeData 220 try: 221 instance.actual_instance = ShapeData.from_json(json_str) 222 matches.append(instance.actual_instance) 223 except (ValidationError, ValueError) as e: 224 error_messages.append(str(e)) 225 # deserialize data into StickyNoteData 226 try: 227 instance.actual_instance = StickyNoteData.from_json(json_str) 228 matches.append(instance.actual_instance) 229 except (ValidationError, ValueError) as e: 230 error_messages.append(str(e)) 231 # deserialize data into TextData 232 try: 233 instance.actual_instance = TextData.from_json(json_str) 234 matches.append(instance.actual_instance) 235 except (ValidationError, ValueError) as e: 236 error_messages.append(str(e)) 237 238 if not matches: 239 # no match 240 raise ValueError( 241 "No match found when deserializing the JSON string into ItemDataPlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardDataResponse, CardData, DocumentDataResponse, EmbedDataResponse, ImageDataResponse, ShapeData, StickyNoteData, TextData. Details: " 242 + ", ".join(error_messages) 243 ) 244 245 # Return one match that has least additional_properties 246 if len(matches) > 1: 247 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 248 249 return instance
Returns the object represented by the json string
251 def to_json(self) -> str: 252 """Returns the JSON representation of the actual instance""" 253 if self.actual_instance is None: 254 return "null" 255 256 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 257 return self.actual_instance.to_json() 258 else: 259 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
261 def to_dict( 262 self, 263 ) -> Optional[ 264 Union[ 265 Dict[str, Any], 266 AppCardDataResponse, 267 CardData, 268 DocumentDataResponse, 269 EmbedDataResponse, 270 ImageDataResponse, 271 ShapeData, 272 StickyNoteData, 273 TextData, 274 ] 275 ]: 276 """Returns the dict representation of the actual instance""" 277 if self.actual_instance is None: 278 return None 279 280 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 281 return self.actual_instance.to_dict() 282 else: 283 # primitive type 284 return self.actual_instance
Returns the dict representation of the actual instance
286 def to_str(self) -> str: 287 """Returns the string representation of the actual instance""" 288 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