miro_api.models.item_style

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

Contains information about item-specific styles.

ItemStyle(*args, **kwargs)
57    def __init__(self, *args, **kwargs) -> None:
58        if args:
59            if len(args) > 1:
60                raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
61            if kwargs:
62                raise ValueError("If a position argument is used, keyword arguments cannot be used.")
63            super().__init__(actual_instance=args[0])
64        else:
65            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.

oneof_schema_1_validator: Optional[miro_api.models.app_card_style.AppCardStyle]
oneof_schema_2_validator: Optional[miro_api.models.card_style.CardStyle]
oneof_schema_3_validator: Optional[miro_api.models.shape_style.ShapeStyle]
oneof_schema_4_validator: Optional[miro_api.models.sticky_note_style.StickyNoteStyle]
oneof_schema_5_validator: Optional[miro_api.models.text_style.TextStyle]
one_of_schemas: List[str]
model_config = {'validate_assignment': True, 'protected_namespaces': ()}
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
 70    @field_validator("actual_instance")
 71    def actual_instance_must_validate_oneof(cls, v):
 72        instance = ItemStyle.model_construct()
 73        error_messages = []
 74        match = 0
 75        # validate data type: AppCardStyle
 76        if not isinstance(v, AppCardStyle):
 77            error_messages.append(f"Error! Input type `{type(v)}` is not `AppCardStyle`")
 78        else:
 79            match += 1
 80        # validate data type: CardStyle
 81        if not isinstance(v, CardStyle):
 82            error_messages.append(f"Error! Input type `{type(v)}` is not `CardStyle`")
 83        else:
 84            match += 1
 85        # validate data type: ShapeStyle
 86        if not isinstance(v, ShapeStyle):
 87            error_messages.append(f"Error! Input type `{type(v)}` is not `ShapeStyle`")
 88        else:
 89            match += 1
 90        # validate data type: StickyNoteStyle
 91        if not isinstance(v, StickyNoteStyle):
 92            error_messages.append(f"Error! Input type `{type(v)}` is not `StickyNoteStyle`")
 93        else:
 94            match += 1
 95        # validate data type: TextStyle
 96        if not isinstance(v, TextStyle):
 97            error_messages.append(f"Error! Input type `{type(v)}` is not `TextStyle`")
 98        else:
 99            match += 1
100        if match > 1:
101            # more than 1 match
102            raise ValueError(
103                "Multiple matches found when setting `actual_instance` in ItemStyle with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: "
104                + ", ".join(error_messages)
105            )
106        elif match == 0:
107            # no match
108            raise ValueError(
109                "No match found when setting `actual_instance` in ItemStyle with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: "
110                + ", ".join(error_messages)
111            )
112        else:
113            return v
@classmethod
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> typing_extensions.Self:
115    @classmethod
116    def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
117        return cls.from_json(json.dumps(obj))
119    @classmethod
120    def from_json(cls, json_str: str) -> Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]:
121        """Returns the object represented by the json string"""
122        instance = cls.model_construct()
123        error_messages = []
124        matches = []
125
126        # deserialize data into AppCardStyle
127        try:
128            instance.actual_instance = AppCardStyle.from_json(json_str)
129            matches.append(instance.actual_instance)
130        except (ValidationError, ValueError) as e:
131            error_messages.append(str(e))
132        # deserialize data into CardStyle
133        try:
134            instance.actual_instance = CardStyle.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 ShapeStyle
139        try:
140            instance.actual_instance = ShapeStyle.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 StickyNoteStyle
145        try:
146            instance.actual_instance = StickyNoteStyle.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 TextStyle
151        try:
152            instance.actual_instance = TextStyle.from_json(json_str)
153            matches.append(instance.actual_instance)
154        except (ValidationError, ValueError) as e:
155            error_messages.append(str(e))
156
157        if not matches:
158            # no match
159            raise ValueError(
160                "No match found when deserializing the JSON string into ItemStyle with oneOf schemas: AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle. Details: "
161                + ", ".join(error_messages)
162            )
163
164        # Return one match that has least additional_properties
165        if len(matches) > 1:
166            instance.actual_instance = sorted(matches, key=lambda m: len(m.additional_properties))[0]
167
168        return instance

Returns the object represented by the json string

def to_json(self) -> str:
170    def to_json(self) -> str:
171        """Returns the JSON representation of the actual instance"""
172        if self.actual_instance is None:
173            return "null"
174
175        if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
176            return self.actual_instance.to_json()
177        else:
178            return json.dumps(self.actual_instance)

Returns the JSON representation of the actual instance

180    def to_dict(
181        self,
182    ) -> Optional[Union[Dict[str, Any], AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle]]:
183        """Returns the dict representation of the actual instance"""
184        if self.actual_instance is None:
185            return None
186
187        if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
188            return self.actual_instance.to_dict()
189        else:
190            # primitive type
191            return self.actual_instance

Returns the dict representation of the actual instance

def to_str(self) -> str:
193    def to_str(self) -> str:
194        """Returns the string representation of the actual instance"""
195        return pprint.pformat(self.model_dump())

Returns the string representation of the actual instance

model_fields = {'oneof_schema_1_validator': FieldInfo(annotation=Union[AppCardStyle, NoneType], required=False), 'oneof_schema_2_validator': FieldInfo(annotation=Union[CardStyle, NoneType], required=False), 'oneof_schema_3_validator': FieldInfo(annotation=Union[ShapeStyle, NoneType], required=False), 'oneof_schema_4_validator': FieldInfo(annotation=Union[StickyNoteStyle, NoneType], required=False), 'oneof_schema_5_validator': FieldInfo(annotation=Union[TextStyle, NoneType], required=False), 'actual_instance': FieldInfo(annotation=Union[AppCardStyle, CardStyle, ShapeStyle, StickyNoteStyle, TextStyle, NoneType], required=False), 'one_of_schemas': FieldInfo(annotation=List[str], required=False, default=typing_extensions.Literal['AppCardStyle', 'CardStyle', 'ShapeStyle', 'StickyNoteStyle', 'TextStyle'])}
model_computed_fields = {}
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