vectorize_client.models.googledriveoauth_config
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, StrictFloat, StrictInt, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List, Optional, Union 22from typing import Optional, Set 23from typing_extensions import Self 24 25class GOOGLEDRIVEOAUTHConfig(BaseModel): 26 """ 27 Configuration for Google Drive OAuth connector 28 """ # noqa: E501 29 file_extensions: List[StrictStr] = Field(description="File Extensions", alias="file-extensions") 30 idle_time: Optional[Union[StrictFloat, StrictInt]] = Field(default=30, description="Polling Interval (seconds). Example: Enter polling interval in seconds", alias="idle-time") 31 __properties: ClassVar[List[str]] = ["file-extensions", "idle-time"] 32 33 @field_validator('file_extensions') 34 def file_extensions_validate_enum(cls, value): 35 """Validates the enum""" 36 for i in value: 37 if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']): 38 raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')") 39 return value 40 41 model_config = ConfigDict( 42 populate_by_name=True, 43 validate_assignment=True, 44 protected_namespaces=(), 45 ) 46 47 48 def to_str(self) -> str: 49 """Returns the string representation of the model using alias""" 50 return pprint.pformat(self.model_dump(by_alias=True)) 51 52 def to_json(self) -> str: 53 """Returns the JSON representation of the model using alias""" 54 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 55 return json.dumps(self.to_dict()) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of GOOGLEDRIVEOAUTHConfig from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 """ 72 excluded_fields: Set[str] = set([ 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 return _dict 81 82 @classmethod 83 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 84 """Create an instance of GOOGLEDRIVEOAUTHConfig from a dict""" 85 if obj is None: 86 return None 87 88 if not isinstance(obj, dict): 89 return cls.model_validate(obj) 90 91 _obj = cls.model_validate({ 92 "file-extensions": obj.get("file-extensions"), 93 "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30 94 }) 95 return _obj
class
GOOGLEDRIVEOAUTHConfig(pydantic.main.BaseModel):
26class GOOGLEDRIVEOAUTHConfig(BaseModel): 27 """ 28 Configuration for Google Drive OAuth connector 29 """ # noqa: E501 30 file_extensions: List[StrictStr] = Field(description="File Extensions", alias="file-extensions") 31 idle_time: Optional[Union[StrictFloat, StrictInt]] = Field(default=30, description="Polling Interval (seconds). Example: Enter polling interval in seconds", alias="idle-time") 32 __properties: ClassVar[List[str]] = ["file-extensions", "idle-time"] 33 34 @field_validator('file_extensions') 35 def file_extensions_validate_enum(cls, value): 36 """Validates the enum""" 37 for i in value: 38 if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']): 39 raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')") 40 return value 41 42 model_config = ConfigDict( 43 populate_by_name=True, 44 validate_assignment=True, 45 protected_namespaces=(), 46 ) 47 48 49 def to_str(self) -> str: 50 """Returns the string representation of the model using alias""" 51 return pprint.pformat(self.model_dump(by_alias=True)) 52 53 def to_json(self) -> str: 54 """Returns the JSON representation of the model using alias""" 55 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 return json.dumps(self.to_dict()) 57 58 @classmethod 59 def from_json(cls, json_str: str) -> Optional[Self]: 60 """Create an instance of GOOGLEDRIVEOAUTHConfig from a JSON string""" 61 return cls.from_dict(json.loads(json_str)) 62 63 def to_dict(self) -> Dict[str, Any]: 64 """Return the dictionary representation of the model using alias. 65 66 This has the following differences from calling pydantic's 67 `self.model_dump(by_alias=True)`: 68 69 * `None` is only added to the output dict for nullable fields that 70 were set at model initialization. Other fields with value `None` 71 are ignored. 72 """ 73 excluded_fields: Set[str] = set([ 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 return _dict 82 83 @classmethod 84 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 85 """Create an instance of GOOGLEDRIVEOAUTHConfig 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 "file-extensions": obj.get("file-extensions"), 94 "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30 95 }) 96 return _obj
Configuration for Google Drive OAuth connector
idle_time: Union[Annotated[float, Strict(strict=True)], Annotated[int, Strict(strict=True)], NoneType]
@field_validator('file_extensions')
def
file_extensions_validate_enum(cls, value):
34 @field_validator('file_extensions') 35 def file_extensions_validate_enum(cls, value): 36 """Validates the enum""" 37 for i in value: 38 if i not in set(['pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv']): 39 raise ValueError("each list item must be one of ('pdf', 'doc,docx,gdoc,odt,rtf,epub', 'ppt,pptx,gslides', 'xls,xlsx,gsheets,ods', 'eml,msg', 'txt', 'html,htm', 'md', 'jpg,jpeg,png,webp,svg,gif', 'json', 'csv')") 40 return value
Validates the enum
model_config =
{'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': (), 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
def
to_str(self) -> str:
49 def to_str(self) -> str: 50 """Returns the string representation of the model using alias""" 51 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
53 def to_json(self) -> str: 54 """Returns the JSON representation of the model using alias""" 55 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 56 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]:
58 @classmethod 59 def from_json(cls, json_str: str) -> Optional[Self]: 60 """Create an instance of GOOGLEDRIVEOAUTHConfig from a JSON string""" 61 return cls.from_dict(json.loads(json_str))
Create an instance of GOOGLEDRIVEOAUTHConfig from a JSON string
def
to_dict(self) -> Dict[str, Any]:
63 def to_dict(self) -> Dict[str, Any]: 64 """Return the dictionary representation of the model using alias. 65 66 This has the following differences from calling pydantic's 67 `self.model_dump(by_alias=True)`: 68 69 * `None` is only added to the output dict for nullable fields that 70 were set at model initialization. Other fields with value `None` 71 are ignored. 72 """ 73 excluded_fields: Set[str] = set([ 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 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]:
83 @classmethod 84 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 85 """Create an instance of GOOGLEDRIVEOAUTHConfig 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 "file-extensions": obj.get("file-extensions"), 94 "idle-time": obj.get("idle-time") if obj.get("idle-time") is not None else 30 95 }) 96 return _obj
Create an instance of GOOGLEDRIVEOAUTHConfig from a dict