miro_api.models.legal_hold_response
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 pprint 17import re # noqa: F401 18import json 19 20from datetime import datetime 21from pydantic import BaseModel, Field, StrictStr, field_validator 22from typing import Any, ClassVar, Dict, List, Optional 23from typing_extensions import Annotated 24from miro_api.models.legal_hold_response_scope import LegalHoldResponseScope 25from miro_api.models.legal_hold_state import LegalHoldState 26from miro_api.models.user import User 27from typing import Optional, Set 28from typing_extensions import Self 29 30 31class LegalHoldResponse(BaseModel): 32 """ 33 LegalHoldResponse 34 """ # noqa: E501 35 36 id: Annotated[str, Field(strict=True)] = Field(description="Unique identifier of the legal hold.") 37 organization_id: Annotated[str, Field(strict=True)] = Field( 38 description="Unique identifier of the organization.", alias="organizationId" 39 ) 40 case_id: Annotated[str, Field(strict=True)] = Field(description="Unique identifier of the case.", alias="caseId") 41 name: StrictStr = Field(description="The name of the legal hold.") 42 description: Optional[StrictStr] = Field(default=None, description="The description of the legal hold.") 43 state: LegalHoldState 44 scope: LegalHoldResponseScope 45 created_by: User = Field(alias="createdBy") 46 created_at: datetime = Field(alias="createdAt") 47 last_modified_at: datetime = Field(alias="lastModifiedAt") 48 additional_properties: Dict[str, Any] = {} 49 __properties: ClassVar[List[str]] = [ 50 "id", 51 "organizationId", 52 "caseId", 53 "name", 54 "description", 55 "state", 56 "scope", 57 "createdBy", 58 "createdAt", 59 "lastModifiedAt", 60 ] 61 62 @field_validator("id") 63 def id_validate_regular_expression(cls, value): 64 """Validates the regular expression""" 65 if not re.match(r"^[0-9]+$", value): 66 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 67 return value 68 69 @field_validator("organization_id") 70 def organization_id_validate_regular_expression(cls, value): 71 """Validates the regular expression""" 72 if not re.match(r"^[0-9]+$", value): 73 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 74 return value 75 76 @field_validator("case_id") 77 def case_id_validate_regular_expression(cls, value): 78 """Validates the regular expression""" 79 if not re.match(r"^[0-9]+$", value): 80 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 81 return value 82 83 model_config = { 84 "populate_by_name": True, 85 "validate_assignment": True, 86 "protected_namespaces": (), 87 } 88 89 def to_str(self) -> str: 90 """Returns the string representation of the model using alias""" 91 return pprint.pformat(self.model_dump(by_alias=True)) 92 93 def to_json(self) -> str: 94 """Returns the JSON representation of the model using alias""" 95 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 96 return json.dumps(self.to_dict()) 97 98 @classmethod 99 def from_json(cls, json_str: str) -> Optional[Self]: 100 """Create an instance of LegalHoldResponse from a JSON string""" 101 return cls.from_dict(json.loads(json_str)) 102 103 def to_dict(self) -> Dict[str, Any]: 104 """Return the dictionary representation of the model using alias. 105 106 This has the following differences from calling pydantic's 107 `self.model_dump(by_alias=True)`: 108 109 * `None` is only added to the output dict for nullable fields that 110 were set at model initialization. Other fields with value `None` 111 are ignored. 112 * Fields in `self.additional_properties` are added to the output dict. 113 """ 114 excluded_fields: Set[str] = set( 115 [ 116 "additional_properties", 117 ] 118 ) 119 120 _dict = self.model_dump( 121 by_alias=True, 122 exclude=excluded_fields, 123 exclude_none=True, 124 ) 125 # override the default output from pydantic by calling `to_dict()` of scope 126 if self.scope: 127 _dict["scope"] = self.scope.to_dict() 128 # override the default output from pydantic by calling `to_dict()` of created_by 129 if self.created_by: 130 _dict["createdBy"] = self.created_by.to_dict() 131 # puts key-value pairs in additional_properties in the top level 132 if self.additional_properties is not None: 133 for _key, _value in self.additional_properties.items(): 134 _dict[_key] = _value 135 136 return _dict 137 138 @classmethod 139 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 140 """Create an instance of LegalHoldResponse from a dict""" 141 if obj is None: 142 return None 143 144 if not isinstance(obj, dict): 145 return cls.model_validate(obj) 146 147 _obj = cls.model_validate( 148 { 149 "id": obj.get("id"), 150 "organizationId": obj.get("organizationId"), 151 "caseId": obj.get("caseId"), 152 "name": obj.get("name"), 153 "description": obj.get("description"), 154 "state": obj.get("state"), 155 "scope": LegalHoldResponseScope.from_dict(obj["scope"]) if obj.get("scope") is not None else None, 156 "createdBy": User.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 157 "createdAt": obj.get("createdAt"), 158 "lastModifiedAt": obj.get("lastModifiedAt"), 159 } 160 ) 161 # store additional fields in additional_properties 162 for _key in obj.keys(): 163 if _key not in cls.__properties: 164 _obj.additional_properties[_key] = obj.get(_key) 165 166 return _obj
32class LegalHoldResponse(BaseModel): 33 """ 34 LegalHoldResponse 35 """ # noqa: E501 36 37 id: Annotated[str, Field(strict=True)] = Field(description="Unique identifier of the legal hold.") 38 organization_id: Annotated[str, Field(strict=True)] = Field( 39 description="Unique identifier of the organization.", alias="organizationId" 40 ) 41 case_id: Annotated[str, Field(strict=True)] = Field(description="Unique identifier of the case.", alias="caseId") 42 name: StrictStr = Field(description="The name of the legal hold.") 43 description: Optional[StrictStr] = Field(default=None, description="The description of the legal hold.") 44 state: LegalHoldState 45 scope: LegalHoldResponseScope 46 created_by: User = Field(alias="createdBy") 47 created_at: datetime = Field(alias="createdAt") 48 last_modified_at: datetime = Field(alias="lastModifiedAt") 49 additional_properties: Dict[str, Any] = {} 50 __properties: ClassVar[List[str]] = [ 51 "id", 52 "organizationId", 53 "caseId", 54 "name", 55 "description", 56 "state", 57 "scope", 58 "createdBy", 59 "createdAt", 60 "lastModifiedAt", 61 ] 62 63 @field_validator("id") 64 def id_validate_regular_expression(cls, value): 65 """Validates the regular expression""" 66 if not re.match(r"^[0-9]+$", value): 67 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 68 return value 69 70 @field_validator("organization_id") 71 def organization_id_validate_regular_expression(cls, value): 72 """Validates the regular expression""" 73 if not re.match(r"^[0-9]+$", value): 74 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 75 return value 76 77 @field_validator("case_id") 78 def case_id_validate_regular_expression(cls, value): 79 """Validates the regular expression""" 80 if not re.match(r"^[0-9]+$", value): 81 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 82 return value 83 84 model_config = { 85 "populate_by_name": True, 86 "validate_assignment": True, 87 "protected_namespaces": (), 88 } 89 90 def to_str(self) -> str: 91 """Returns the string representation of the model using alias""" 92 return pprint.pformat(self.model_dump(by_alias=True)) 93 94 def to_json(self) -> str: 95 """Returns the JSON representation of the model using alias""" 96 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 97 return json.dumps(self.to_dict()) 98 99 @classmethod 100 def from_json(cls, json_str: str) -> Optional[Self]: 101 """Create an instance of LegalHoldResponse from a JSON string""" 102 return cls.from_dict(json.loads(json_str)) 103 104 def to_dict(self) -> Dict[str, Any]: 105 """Return the dictionary representation of the model using alias. 106 107 This has the following differences from calling pydantic's 108 `self.model_dump(by_alias=True)`: 109 110 * `None` is only added to the output dict for nullable fields that 111 were set at model initialization. Other fields with value `None` 112 are ignored. 113 * Fields in `self.additional_properties` are added to the output dict. 114 """ 115 excluded_fields: Set[str] = set( 116 [ 117 "additional_properties", 118 ] 119 ) 120 121 _dict = self.model_dump( 122 by_alias=True, 123 exclude=excluded_fields, 124 exclude_none=True, 125 ) 126 # override the default output from pydantic by calling `to_dict()` of scope 127 if self.scope: 128 _dict["scope"] = self.scope.to_dict() 129 # override the default output from pydantic by calling `to_dict()` of created_by 130 if self.created_by: 131 _dict["createdBy"] = self.created_by.to_dict() 132 # puts key-value pairs in additional_properties in the top level 133 if self.additional_properties is not None: 134 for _key, _value in self.additional_properties.items(): 135 _dict[_key] = _value 136 137 return _dict 138 139 @classmethod 140 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 141 """Create an instance of LegalHoldResponse from a dict""" 142 if obj is None: 143 return None 144 145 if not isinstance(obj, dict): 146 return cls.model_validate(obj) 147 148 _obj = cls.model_validate( 149 { 150 "id": obj.get("id"), 151 "organizationId": obj.get("organizationId"), 152 "caseId": obj.get("caseId"), 153 "name": obj.get("name"), 154 "description": obj.get("description"), 155 "state": obj.get("state"), 156 "scope": LegalHoldResponseScope.from_dict(obj["scope"]) if obj.get("scope") is not None else None, 157 "createdBy": User.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 158 "createdAt": obj.get("createdAt"), 159 "lastModifiedAt": obj.get("lastModifiedAt"), 160 } 161 ) 162 # store additional fields in additional_properties 163 for _key in obj.keys(): 164 if _key not in cls.__properties: 165 _obj.additional_properties[_key] = obj.get(_key) 166 167 return _obj
LegalHoldResponse
63 @field_validator("id") 64 def id_validate_regular_expression(cls, value): 65 """Validates the regular expression""" 66 if not re.match(r"^[0-9]+$", value): 67 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 68 return value
Validates the regular expression
70 @field_validator("organization_id") 71 def organization_id_validate_regular_expression(cls, value): 72 """Validates the regular expression""" 73 if not re.match(r"^[0-9]+$", value): 74 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 75 return value
Validates the regular expression
77 @field_validator("case_id") 78 def case_id_validate_regular_expression(cls, value): 79 """Validates the regular expression""" 80 if not re.match(r"^[0-9]+$", value): 81 raise ValueError(r"must validate the regular expression /^[0-9]+$/") 82 return value
Validates the regular expression
90 def to_str(self) -> str: 91 """Returns the string representation of the model using alias""" 92 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
94 def to_json(self) -> str: 95 """Returns the JSON representation of the model using alias""" 96 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 97 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
99 @classmethod 100 def from_json(cls, json_str: str) -> Optional[Self]: 101 """Create an instance of LegalHoldResponse from a JSON string""" 102 return cls.from_dict(json.loads(json_str))
Create an instance of LegalHoldResponse from a JSON string
104 def to_dict(self) -> Dict[str, Any]: 105 """Return the dictionary representation of the model using alias. 106 107 This has the following differences from calling pydantic's 108 `self.model_dump(by_alias=True)`: 109 110 * `None` is only added to the output dict for nullable fields that 111 were set at model initialization. Other fields with value `None` 112 are ignored. 113 * Fields in `self.additional_properties` are added to the output dict. 114 """ 115 excluded_fields: Set[str] = set( 116 [ 117 "additional_properties", 118 ] 119 ) 120 121 _dict = self.model_dump( 122 by_alias=True, 123 exclude=excluded_fields, 124 exclude_none=True, 125 ) 126 # override the default output from pydantic by calling `to_dict()` of scope 127 if self.scope: 128 _dict["scope"] = self.scope.to_dict() 129 # override the default output from pydantic by calling `to_dict()` of created_by 130 if self.created_by: 131 _dict["createdBy"] = self.created_by.to_dict() 132 # puts key-value pairs in additional_properties in the top level 133 if self.additional_properties is not None: 134 for _key, _value in self.additional_properties.items(): 135 _dict[_key] = _value 136 137 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True)
:
None
is only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNone
are ignored.- Fields in
self.additional_properties
are added to the output dict.
139 @classmethod 140 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 141 """Create an instance of LegalHoldResponse from a dict""" 142 if obj is None: 143 return None 144 145 if not isinstance(obj, dict): 146 return cls.model_validate(obj) 147 148 _obj = cls.model_validate( 149 { 150 "id": obj.get("id"), 151 "organizationId": obj.get("organizationId"), 152 "caseId": obj.get("caseId"), 153 "name": obj.get("name"), 154 "description": obj.get("description"), 155 "state": obj.get("state"), 156 "scope": LegalHoldResponseScope.from_dict(obj["scope"]) if obj.get("scope") is not None else None, 157 "createdBy": User.from_dict(obj["createdBy"]) if obj.get("createdBy") is not None else None, 158 "createdAt": obj.get("createdAt"), 159 "lastModifiedAt": obj.get("lastModifiedAt"), 160 } 161 ) 162 # store additional fields in additional_properties 163 for _key in obj.keys(): 164 if _key not in cls.__properties: 165 _obj.additional_properties[_key] = obj.get(_key) 166 167 return _obj
Create an instance of LegalHoldResponse from a dict
265def init_private_attributes(self: BaseModel, __context: Any) -> None: 266 """This function is meant to behave like a BaseModel method to initialise private attributes. 267 268 It takes context as an argument since that's what pydantic-core passes when calling it. 269 270 Args: 271 self: The BaseModel instance. 272 __context: The context. 273 """ 274 if getattr(self, '__pydantic_private__', None) is None: 275 pydantic_private = {} 276 for name, private_attr in self.__private_attributes__.items(): 277 default = private_attr.get_default() 278 if default is not PydanticUndefined: 279 pydantic_private[name] = default 280 object_setattr(self, '__pydantic_private__', pydantic_private)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that's what pydantic-core passes when calling it.
Args: self: The BaseModel instance. __context: The context.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- 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