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