miro_api.models.item_style_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 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.app_card_style import AppCardStyle 20from miro_api.models.card_style import CardStyle 21from miro_api.models.shape_style import ShapeStyle 22from miro_api.models.sticky_note_style import StickyNoteStyle 23from miro_api.models.text_style import TextStyle 24from pydantic import StrictStr, Field 25from typing import Union, List, Optional, Dict 26from typing_extensions import Literal, Self 27 28ITEMSTYLEPLATFORMCREATEITEMSINBULKUSINGFILEFROMDEVICE_ONE_OF_SCHEMAS = [ 29 "AppCardStyle", 30 "CardStyle", 31 "ShapeStyle", 32 "StickyNoteStyle", 33 "TextStyle", 34] 35 36 37class ItemStylePlatformcreateitemsinbulkusingfilefromdevice(BaseModel): 38 """ 39 Contains information about item-specific styles. 40 """ 41 42 # data type: AppCardStyle 43 oneof_schema_1_validator: Optional[AppCardStyle] = None 44 # data type: CardStyle 45 oneof_schema_2_validator: Optional[CardStyle] = None 46 # data type: ShapeStyle 47 oneof_schema_3_validator: Optional[ShapeStyle] = None 48 # data type: StickyNoteStyle 49 oneof_schema_4_validator: Optional[StickyNoteStyle] = None 50 # data type: TextStyle 51 oneof_schema_5_validator: Optional[TextStyle] = None 52 actual_instance: Optional[Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]] = None 53 one_of_schemas: List[str] = Field( 54 default=Literal["AppCardStyle", "CardStyle", "ShapeStyle", "StickyNoteStyle", "TextStyle"] 55 ) 56 57 model_config = { 58 "validate_assignment": True, 59 "protected_namespaces": (), 60 } 61 62 def __init__(self, *args, **kwargs) -> None: 63 if args: 64 if len(args) > 1: 65 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 66 if kwargs: 67 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 68 super().__init__(actual_instance=args[0]) 69 else: 70 super().__init__(**kwargs) 71 72 def __getattr__(self, attr: str): 73 return getattr(self.actual_instance, attr) 74 75 @field_validator("actual_instance") 76 def actual_instance_must_validate_oneof(cls, v): 77 instance = ItemStylePlatformcreateitemsinbulkusingfilefromdevice.model_construct() 78 error_messages = [] 79 match = 0 80 # validate data type: AppCardStyle 81 if not isinstance(v, AppCardStyle): 82 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardStyle`") 83 else: 84 match += 1 85 # validate data type: CardStyle 86 if not isinstance(v, CardStyle): 87 error_messages.append(f"Error! Input type `{type(v)}` is not `CardStyle`") 88 else: 89 match += 1 90 # validate data type: ShapeStyle 91 if not isinstance(v, ShapeStyle): 92 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeStyle`") 93 else: 94 match += 1 95 # validate data type: StickyNoteStyle 96 if not isinstance(v, StickyNoteStyle): 97 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteStyle`") 98 else: 99 match += 1 100 # validate data type: TextStyle 101 if not isinstance(v, TextStyle): 102 error_messages.append(f"Error! Input type `{type(v)}` is not `TextStyle`") 103 else: 104 match += 1 105 if match > 1: 106 # more than 1 match 107 raise ValueError( 108 "Multiple matches found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 109 + ", ".join(error_messages) 110 ) 111 elif match == 0: 112 # no match 113 raise ValueError( 114 "No match found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 115 + ", ".join(error_messages) 116 ) 117 else: 118 return v 119 120 @classmethod 121 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 122 return cls.from_json(json.dumps(obj)) 123 124 @classmethod 125 def from_json(cls, json_str: str) -> Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]: 126 """Returns the object represented by the json string""" 127 instance = cls.model_construct() 128 error_messages = [] 129 matches = [] 130 131 # deserialize data into AppCardStyle 132 try: 133 instance.actual_instance = AppCardStyle.from_json(json_str) 134 matches.append(instance.actual_instance) 135 except (ValidationError, ValueError) as e: 136 error_messages.append(str(e)) 137 # deserialize data into CardStyle 138 try: 139 instance.actual_instance = CardStyle.from_json(json_str) 140 matches.append(instance.actual_instance) 141 except (ValidationError, ValueError) as e: 142 error_messages.append(str(e)) 143 # deserialize data into ShapeStyle 144 try: 145 instance.actual_instance = ShapeStyle.from_json(json_str) 146 matches.append(instance.actual_instance) 147 except (ValidationError, ValueError) as e: 148 error_messages.append(str(e)) 149 # deserialize data into StickyNoteStyle 150 try: 151 instance.actual_instance = StickyNoteStyle.from_json(json_str) 152 matches.append(instance.actual_instance) 153 except (ValidationError, ValueError) as e: 154 error_messages.append(str(e)) 155 # deserialize data into TextStyle 156 try: 157 instance.actual_instance = TextStyle.from_json(json_str) 158 matches.append(instance.actual_instance) 159 except (ValidationError, ValueError) as e: 160 error_messages.append(str(e)) 161 162 if not matches: 163 # no match 164 raise ValueError( 165 "No match found when deserializing the JSON string into ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 166 + ", ".join(error_messages) 167 ) 168 169 # Return one match that has least additional_properties 170 if len(matches) > 1: 171 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 172 173 return instance 174 175 def to_json(self) -> str: 176 """Returns the JSON representation of the actual instance""" 177 if self.actual_instance is None: 178 return "null" 179 180 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 181 return self.actual_instance.to_json() 182 else: 183 return json.dumps(self.actual_instance) 184 185 def to_dict( 186 self, 187 ) -> Optional[Union[Dict[str, Any], AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]]: 188 """Returns the dict representation of the actual instance""" 189 if self.actual_instance is None: 190 return None 191 192 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 193 return self.actual_instance.to_dict() 194 else: 195 # primitive type 196 return self.actual_instance 197 198 def to_str(self) -> str: 199 """Returns the string representation of the actual instance""" 200 return pprint.pformat(self.model_dump())
38class ItemStylePlatformcreateitemsinbulkusingfilefromdevice(BaseModel): 39 """ 40 Contains information about item-specific styles. 41 """ 42 43 # data type: AppCardStyle 44 oneof_schema_1_validator: Optional[AppCardStyle] = None 45 # data type: CardStyle 46 oneof_schema_2_validator: Optional[CardStyle] = None 47 # data type: ShapeStyle 48 oneof_schema_3_validator: Optional[ShapeStyle] = None 49 # data type: StickyNoteStyle 50 oneof_schema_4_validator: Optional[StickyNoteStyle] = None 51 # data type: TextStyle 52 oneof_schema_5_validator: Optional[TextStyle] = None 53 actual_instance: Optional[Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]] = None 54 one_of_schemas: List[str] = Field( 55 default=Literal["AppCardStyle", "CardStyle", "ShapeStyle", "StickyNoteStyle", "TextStyle"] 56 ) 57 58 model_config = { 59 "validate_assignment": True, 60 "protected_namespaces": (), 61 } 62 63 def __init__(self, *args, **kwargs) -> None: 64 if args: 65 if len(args) > 1: 66 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 67 if kwargs: 68 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 69 super().__init__(actual_instance=args[0]) 70 else: 71 super().__init__(**kwargs) 72 73 def __getattr__(self, attr: str): 74 return getattr(self.actual_instance, attr) 75 76 @field_validator("actual_instance") 77 def actual_instance_must_validate_oneof(cls, v): 78 instance = ItemStylePlatformcreateitemsinbulkusingfilefromdevice.model_construct() 79 error_messages = [] 80 match = 0 81 # validate data type: AppCardStyle 82 if not isinstance(v, AppCardStyle): 83 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardStyle`") 84 else: 85 match += 1 86 # validate data type: CardStyle 87 if not isinstance(v, CardStyle): 88 error_messages.append(f"Error! Input type `{type(v)}` is not `CardStyle`") 89 else: 90 match += 1 91 # validate data type: ShapeStyle 92 if not isinstance(v, ShapeStyle): 93 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeStyle`") 94 else: 95 match += 1 96 # validate data type: StickyNoteStyle 97 if not isinstance(v, StickyNoteStyle): 98 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteStyle`") 99 else: 100 match += 1 101 # validate data type: TextStyle 102 if not isinstance(v, TextStyle): 103 error_messages.append(f"Error! Input type `{type(v)}` is not `TextStyle`") 104 else: 105 match += 1 106 if match > 1: 107 # more than 1 match 108 raise ValueError( 109 "Multiple matches found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 110 + ", ".join(error_messages) 111 ) 112 elif match == 0: 113 # no match 114 raise ValueError( 115 "No match found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 116 + ", ".join(error_messages) 117 ) 118 else: 119 return v 120 121 @classmethod 122 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 123 return cls.from_json(json.dumps(obj)) 124 125 @classmethod 126 def from_json(cls, json_str: str) -> Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]: 127 """Returns the object represented by the json string""" 128 instance = cls.model_construct() 129 error_messages = [] 130 matches = [] 131 132 # deserialize data into AppCardStyle 133 try: 134 instance.actual_instance = AppCardStyle.from_json(json_str) 135 matches.append(instance.actual_instance) 136 except (ValidationError, ValueError) as e: 137 error_messages.append(str(e)) 138 # deserialize data into CardStyle 139 try: 140 instance.actual_instance = CardStyle.from_json(json_str) 141 matches.append(instance.actual_instance) 142 except (ValidationError, ValueError) as e: 143 error_messages.append(str(e)) 144 # deserialize data into ShapeStyle 145 try: 146 instance.actual_instance = ShapeStyle.from_json(json_str) 147 matches.append(instance.actual_instance) 148 except (ValidationError, ValueError) as e: 149 error_messages.append(str(e)) 150 # deserialize data into StickyNoteStyle 151 try: 152 instance.actual_instance = StickyNoteStyle.from_json(json_str) 153 matches.append(instance.actual_instance) 154 except (ValidationError, ValueError) as e: 155 error_messages.append(str(e)) 156 # deserialize data into TextStyle 157 try: 158 instance.actual_instance = TextStyle.from_json(json_str) 159 matches.append(instance.actual_instance) 160 except (ValidationError, ValueError) as e: 161 error_messages.append(str(e)) 162 163 if not matches: 164 # no match 165 raise ValueError( 166 "No match found when deserializing the JSON string into ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 167 + ", ".join(error_messages) 168 ) 169 170 # Return one match that has least additional_properties 171 if len(matches) > 1: 172 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 173 174 return instance 175 176 def to_json(self) -> str: 177 """Returns the JSON representation of the actual instance""" 178 if self.actual_instance is None: 179 return "null" 180 181 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 182 return self.actual_instance.to_json() 183 else: 184 return json.dumps(self.actual_instance) 185 186 def to_dict( 187 self, 188 ) -> Optional[Union[Dict[str, Any], AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]]: 189 """Returns the dict representation of the actual instance""" 190 if self.actual_instance is None: 191 return None 192 193 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 194 return self.actual_instance.to_dict() 195 else: 196 # primitive type 197 return self.actual_instance 198 199 def to_str(self) -> str: 200 """Returns the string representation of the actual instance""" 201 return pprint.pformat(self.model_dump())
Contains information about item-specific styles.
63 def __init__(self, *args, **kwargs) -> None: 64 if args: 65 if len(args) > 1: 66 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 67 if kwargs: 68 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 69 super().__init__(actual_instance=args[0]) 70 else: 71 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.
76 @field_validator("actual_instance") 77 def actual_instance_must_validate_oneof(cls, v): 78 instance = ItemStylePlatformcreateitemsinbulkusingfilefromdevice.model_construct() 79 error_messages = [] 80 match = 0 81 # validate data type: AppCardStyle 82 if not isinstance(v, AppCardStyle): 83 error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardStyle`") 84 else: 85 match += 1 86 # validate data type: CardStyle 87 if not isinstance(v, CardStyle): 88 error_messages.append(f"Error! Input type `{type(v)}` is not `CardStyle`") 89 else: 90 match += 1 91 # validate data type: ShapeStyle 92 if not isinstance(v, ShapeStyle): 93 error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeStyle`") 94 else: 95 match += 1 96 # validate data type: StickyNoteStyle 97 if not isinstance(v, StickyNoteStyle): 98 error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteStyle`") 99 else: 100 match += 1 101 # validate data type: TextStyle 102 if not isinstance(v, TextStyle): 103 error_messages.append(f"Error! Input type `{type(v)}` is not `TextStyle`") 104 else: 105 match += 1 106 if match > 1: 107 # more than 1 match 108 raise ValueError( 109 "Multiple matches found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 110 + ", ".join(error_messages) 111 ) 112 elif match == 0: 113 # no match 114 raise ValueError( 115 "No match found when setting `actual_instance` in ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 116 + ", ".join(error_messages) 117 ) 118 else: 119 return v
125 @classmethod 126 def from_json(cls, json_str: str) -> Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]: 127 """Returns the object represented by the json string""" 128 instance = cls.model_construct() 129 error_messages = [] 130 matches = [] 131 132 # deserialize data into AppCardStyle 133 try: 134 instance.actual_instance = AppCardStyle.from_json(json_str) 135 matches.append(instance.actual_instance) 136 except (ValidationError, ValueError) as e: 137 error_messages.append(str(e)) 138 # deserialize data into CardStyle 139 try: 140 instance.actual_instance = CardStyle.from_json(json_str) 141 matches.append(instance.actual_instance) 142 except (ValidationError, ValueError) as e: 143 error_messages.append(str(e)) 144 # deserialize data into ShapeStyle 145 try: 146 instance.actual_instance = ShapeStyle.from_json(json_str) 147 matches.append(instance.actual_instance) 148 except (ValidationError, ValueError) as e: 149 error_messages.append(str(e)) 150 # deserialize data into StickyNoteStyle 151 try: 152 instance.actual_instance = StickyNoteStyle.from_json(json_str) 153 matches.append(instance.actual_instance) 154 except (ValidationError, ValueError) as e: 155 error_messages.append(str(e)) 156 # deserialize data into TextStyle 157 try: 158 instance.actual_instance = TextStyle.from_json(json_str) 159 matches.append(instance.actual_instance) 160 except (ValidationError, ValueError) as e: 161 error_messages.append(str(e)) 162 163 if not matches: 164 # no match 165 raise ValueError( 166 "No match found when deserializing the JSON string into ItemStylePlatformcreateitemsinbulkusingfilefromdevice with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: " 167 + ", ".join(error_messages) 168 ) 169 170 # Return one match that has least additional_properties 171 if len(matches) > 1: 172 instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0] 173 174 return instance
Returns the object represented by the json string
176 def to_json(self) -> str: 177 """Returns the JSON representation of the actual instance""" 178 if self.actual_instance is None: 179 return "null" 180 181 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 182 return self.actual_instance.to_json() 183 else: 184 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
186 def to_dict( 187 self, 188 ) -> Optional[Union[Dict[str, Any], AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]]: 189 """Returns the dict representation of the actual instance""" 190 if self.actual_instance is None: 191 return None 192 193 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 194 return self.actual_instance.to_dict() 195 else: 196 # primitive type 197 return self.actual_instance
Returns the dict representation of the actual instance
199 def to_str(self) -> str: 200 """Returns the string representation of the actual instance""" 201 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