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