vectorize_client.models.get_workspace_by_id_response
Vectorize API
API for Vectorize services (Beta)
The version of the OpenAPI document: 0.1.2 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4 Vectorize API 5 6 API for Vectorize services (Beta) 7 8 The version of the OpenAPI document: 0.1.2 9 Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11 Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import pprint 17import re # noqa: F401 18import json 19 20from pydantic import BaseModel, ConfigDict, Field, StrictStr 21from typing import Any, ClassVar, Dict, List, Optional 22from typing import Optional, Set 23from typing_extensions import Self 24 25class GetWorkspaceByIdResponse(BaseModel): 26 """ 27 GetWorkspaceByIdResponse 28 """ # noqa: E501 29 id: StrictStr 30 name: StrictStr 31 created_at: Optional[StrictStr] = Field(default=None, alias="createdAt") 32 updated_at: Optional[StrictStr] = Field(default=None, alias="updatedAt") 33 __properties: ClassVar[List[str]] = ["id", "name", "createdAt", "updatedAt"] 34 35 model_config = ConfigDict( 36 populate_by_name=True, 37 validate_assignment=True, 38 protected_namespaces=(), 39 ) 40 41 42 def to_str(self) -> str: 43 """Returns the string representation of the model using alias""" 44 return pprint.pformat(self.model_dump(by_alias=True)) 45 46 def to_json(self) -> str: 47 """Returns the JSON representation of the model using alias""" 48 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 49 return json.dumps(self.to_dict()) 50 51 @classmethod 52 def from_json(cls, json_str: str) -> Optional[Self]: 53 """Create an instance of GetWorkspaceByIdResponse from a JSON string""" 54 return cls.from_dict(json.loads(json_str)) 55 56 def to_dict(self) -> Dict[str, Any]: 57 """Return the dictionary representation of the model using alias. 58 59 This has the following differences from calling pydantic's 60 `self.model_dump(by_alias=True)`: 61 62 * `None` is only added to the output dict for nullable fields that 63 were set at model initialization. Other fields with value `None` 64 are ignored. 65 """ 66 excluded_fields: Set[str] = set([ 67 ]) 68 69 _dict = self.model_dump( 70 by_alias=True, 71 exclude=excluded_fields, 72 exclude_none=True, 73 ) 74 # set to None if created_at (nullable) is None 75 # and model_fields_set contains the field 76 if self.created_at is None and "created_at" in self.model_fields_set: 77 _dict['createdAt'] = None 78 79 # set to None if updated_at (nullable) is None 80 # and model_fields_set contains the field 81 if self.updated_at is None and "updated_at" in self.model_fields_set: 82 _dict['updatedAt'] = None 83 84 return _dict 85 86 @classmethod 87 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 88 """Create an instance of GetWorkspaceByIdResponse from a dict""" 89 if obj is None: 90 return None 91 92 if not isinstance(obj, dict): 93 return cls.model_validate(obj) 94 95 _obj = cls.model_validate({ 96 "id": obj.get("id"), 97 "name": obj.get("name"), 98 "createdAt": obj.get("createdAt"), 99 "updatedAt": obj.get("updatedAt") 100 }) 101 return _obj
class
GetWorkspaceByIdResponse(pydantic.main.BaseModel):
26class GetWorkspaceByIdResponse(BaseModel): 27 """ 28 GetWorkspaceByIdResponse 29 """ # noqa: E501 30 id: StrictStr 31 name: StrictStr 32 created_at: Optional[StrictStr] = Field(default=None, alias="createdAt") 33 updated_at: Optional[StrictStr] = Field(default=None, alias="updatedAt") 34 __properties: ClassVar[List[str]] = ["id", "name", "createdAt", "updatedAt"] 35 36 model_config = ConfigDict( 37 populate_by_name=True, 38 validate_assignment=True, 39 protected_namespaces=(), 40 ) 41 42 43 def to_str(self) -> str: 44 """Returns the string representation of the model using alias""" 45 return pprint.pformat(self.model_dump(by_alias=True)) 46 47 def to_json(self) -> str: 48 """Returns the JSON representation of the model using alias""" 49 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 50 return json.dumps(self.to_dict()) 51 52 @classmethod 53 def from_json(cls, json_str: str) -> Optional[Self]: 54 """Create an instance of GetWorkspaceByIdResponse from a JSON string""" 55 return cls.from_dict(json.loads(json_str)) 56 57 def to_dict(self) -> Dict[str, Any]: 58 """Return the dictionary representation of the model using alias. 59 60 This has the following differences from calling pydantic's 61 `self.model_dump(by_alias=True)`: 62 63 * `None` is only added to the output dict for nullable fields that 64 were set at model initialization. Other fields with value `None` 65 are ignored. 66 """ 67 excluded_fields: Set[str] = set([ 68 ]) 69 70 _dict = self.model_dump( 71 by_alias=True, 72 exclude=excluded_fields, 73 exclude_none=True, 74 ) 75 # set to None if created_at (nullable) is None 76 # and model_fields_set contains the field 77 if self.created_at is None and "created_at" in self.model_fields_set: 78 _dict['createdAt'] = None 79 80 # set to None if updated_at (nullable) is None 81 # and model_fields_set contains the field 82 if self.updated_at is None and "updated_at" in self.model_fields_set: 83 _dict['updatedAt'] = None 84 85 return _dict 86 87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of GetWorkspaceByIdResponse from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "id": obj.get("id"), 98 "name": obj.get("name"), 99 "createdAt": obj.get("createdAt"), 100 "updatedAt": obj.get("updatedAt") 101 }) 102 return _obj
GetWorkspaceByIdResponse
model_config =
{'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
def
to_str(self) -> str:
43 def to_str(self) -> str: 44 """Returns the string representation of the model using alias""" 45 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
47 def to_json(self) -> str: 48 """Returns the JSON representation of the model using alias""" 49 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 50 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
@classmethod
def
from_json(cls, json_str: str) -> Optional[Self]:
52 @classmethod 53 def from_json(cls, json_str: str) -> Optional[Self]: 54 """Create an instance of GetWorkspaceByIdResponse from a JSON string""" 55 return cls.from_dict(json.loads(json_str))
Create an instance of GetWorkspaceByIdResponse from a JSON string
def
to_dict(self) -> Dict[str, Any]:
57 def to_dict(self) -> Dict[str, Any]: 58 """Return the dictionary representation of the model using alias. 59 60 This has the following differences from calling pydantic's 61 `self.model_dump(by_alias=True)`: 62 63 * `None` is only added to the output dict for nullable fields that 64 were set at model initialization. Other fields with value `None` 65 are ignored. 66 """ 67 excluded_fields: Set[str] = set([ 68 ]) 69 70 _dict = self.model_dump( 71 by_alias=True, 72 exclude=excluded_fields, 73 exclude_none=True, 74 ) 75 # set to None if created_at (nullable) is None 76 # and model_fields_set contains the field 77 if self.created_at is None and "created_at" in self.model_fields_set: 78 _dict['createdAt'] = None 79 80 # set to None if updated_at (nullable) is None 81 # and model_fields_set contains the field 82 if self.updated_at is None and "updated_at" in self.model_fields_set: 83 _dict['updatedAt'] = None 84 85 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.
@classmethod
def
from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of GetWorkspaceByIdResponse from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "id": obj.get("id"), 98 "name": obj.get("name"), 99 "createdAt": obj.get("createdAt"), 100 "updatedAt": obj.get("updatedAt") 101 }) 102 return _obj
Create an instance of GetWorkspaceByIdResponse from a dict