vectorize_client.models.gmail_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 datetime import date 21from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator 22from typing import Any, ClassVar, Dict, List, Optional, Union 23from typing_extensions import Annotated 24from typing import Optional, Set 25from typing_extensions import Self 26 27class GMAILConfig(BaseModel): 28 """ 29 Configuration for Gmail connector 30 """ # noqa: E501 31 from_filter_type: StrictStr = Field(alias="from-filter-type") 32 to_filter_type: StrictStr = Field(alias="to-filter-type") 33 cc_filter_type: StrictStr = Field(alias="cc-filter-type") 34 subject_filter_type: StrictStr = Field(alias="subject-filter-type") 35 label_filter_type: StrictStr = Field(alias="label-filter-type") 36 var_from: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="From Address Filter. Only include emails from these senders. Example: Add sender email(s)", alias="from") 37 to: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="To Address Filter. Only include emails sent to these recipients. Example: Add recipient email(s)") 38 cc: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="CC Address Filter. Only include emails with these addresses in CC field. Example: Add CC email(s)") 39 include_attachments: Optional[StrictBool] = Field(default=False, description="Include Attachments. Include email attachments in the processed content", alias="include-attachments") 40 subject: Optional[StrictStr] = Field(default=None, description="Subject Filter. Include emails with these keywords in the subject line. Example: Add subject keywords") 41 start_date: Optional[date] = Field(default=None, description="Start Date. Only include emails sent after this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-01", alias="start-date") 42 end_date: Optional[date] = Field(default=None, description="End Date. Only include emails sent before this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-31", alias="end-date") 43 max_results: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum Results. Leave blank for no limit, or specify a maximum number. Example: Enter maximum number of threads to retrieve (leave blank for no limit)", alias="max-results") 44 messages_to_fetch: Optional[List[StrictStr]] = Field(default=None, description="Messages to Fetch. Select which categories of messages to include in the import.", alias="messages-to-fetch") 45 label_ids: Optional[StrictStr] = Field(default=None, description="Label Filters. Include emails with these labels. Example: e.g., INBOX, IMPORTANT, CATEGORY_SOCIAL", alias="label-ids") 46 __properties: ClassVar[List[str]] = ["from-filter-type", "to-filter-type", "cc-filter-type", "subject-filter-type", "label-filter-type", "from", "to", "cc", "include-attachments", "subject", "start-date", "end-date", "max-results", "messages-to-fetch", "label-ids"] 47 48 @field_validator('var_from') 49 def var_from_validate_regular_expression(cls, value): 50 """Validates the regular expression""" 51 if value is None: 52 return value 53 54 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 55 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 56 return value 57 58 @field_validator('to') 59 def to_validate_regular_expression(cls, value): 60 """Validates the regular expression""" 61 if value is None: 62 return value 63 64 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 65 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 66 return value 67 68 @field_validator('cc') 69 def cc_validate_regular_expression(cls, value): 70 """Validates the regular expression""" 71 if value is None: 72 return value 73 74 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 75 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 76 return value 77 78 @field_validator('messages_to_fetch') 79 def messages_to_fetch_validate_enum(cls, value): 80 """Validates the enum""" 81 if value is None: 82 return value 83 84 for i in value: 85 if i not in set(['all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important']): 86 raise ValueError("each list item must be one of ('all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important')") 87 return value 88 89 model_config = ConfigDict( 90 populate_by_name=True, 91 validate_assignment=True, 92 protected_namespaces=(), 93 ) 94 95 96 def to_str(self) -> str: 97 """Returns the string representation of the model using alias""" 98 return pprint.pformat(self.model_dump(by_alias=True)) 99 100 def to_json(self) -> str: 101 """Returns the JSON representation of the model using alias""" 102 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 103 return json.dumps(self.to_dict()) 104 105 @classmethod 106 def from_json(cls, json_str: str) -> Optional[Self]: 107 """Create an instance of GMAILConfig from a JSON string""" 108 return cls.from_dict(json.loads(json_str)) 109 110 def to_dict(self) -> Dict[str, Any]: 111 """Return the dictionary representation of the model using alias. 112 113 This has the following differences from calling pydantic's 114 `self.model_dump(by_alias=True)`: 115 116 * `None` is only added to the output dict for nullable fields that 117 were set at model initialization. Other fields with value `None` 118 are ignored. 119 """ 120 excluded_fields: Set[str] = set([ 121 ]) 122 123 _dict = self.model_dump( 124 by_alias=True, 125 exclude=excluded_fields, 126 exclude_none=True, 127 ) 128 return _dict 129 130 @classmethod 131 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 132 """Create an instance of GMAILConfig from a dict""" 133 if obj is None: 134 return None 135 136 if not isinstance(obj, dict): 137 return cls.model_validate(obj) 138 139 _obj = cls.model_validate({ 140 "from-filter-type": obj.get("from-filter-type") if obj.get("from-filter-type") is not None else 'OR', 141 "to-filter-type": obj.get("to-filter-type") if obj.get("to-filter-type") is not None else 'OR', 142 "cc-filter-type": obj.get("cc-filter-type") if obj.get("cc-filter-type") is not None else 'OR', 143 "subject-filter-type": obj.get("subject-filter-type") if obj.get("subject-filter-type") is not None else 'AND', 144 "label-filter-type": obj.get("label-filter-type") if obj.get("label-filter-type") is not None else 'AND', 145 "from": obj.get("from"), 146 "to": obj.get("to"), 147 "cc": obj.get("cc"), 148 "include-attachments": obj.get("include-attachments") if obj.get("include-attachments") is not None else False, 149 "subject": obj.get("subject"), 150 "start-date": obj.get("start-date"), 151 "end-date": obj.get("end-date"), 152 "max-results": obj.get("max-results"), 153 "messages-to-fetch": obj.get("messages-to-fetch"), 154 "label-ids": obj.get("label-ids") 155 }) 156 return _obj
28class GMAILConfig(BaseModel): 29 """ 30 Configuration for Gmail connector 31 """ # noqa: E501 32 from_filter_type: StrictStr = Field(alias="from-filter-type") 33 to_filter_type: StrictStr = Field(alias="to-filter-type") 34 cc_filter_type: StrictStr = Field(alias="cc-filter-type") 35 subject_filter_type: StrictStr = Field(alias="subject-filter-type") 36 label_filter_type: StrictStr = Field(alias="label-filter-type") 37 var_from: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="From Address Filter. Only include emails from these senders. Example: Add sender email(s)", alias="from") 38 to: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="To Address Filter. Only include emails sent to these recipients. Example: Add recipient email(s)") 39 cc: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="CC Address Filter. Only include emails with these addresses in CC field. Example: Add CC email(s)") 40 include_attachments: Optional[StrictBool] = Field(default=False, description="Include Attachments. Include email attachments in the processed content", alias="include-attachments") 41 subject: Optional[StrictStr] = Field(default=None, description="Subject Filter. Include emails with these keywords in the subject line. Example: Add subject keywords") 42 start_date: Optional[date] = Field(default=None, description="Start Date. Only include emails sent after this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-01", alias="start-date") 43 end_date: Optional[date] = Field(default=None, description="End Date. Only include emails sent before this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-31", alias="end-date") 44 max_results: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum Results. Leave blank for no limit, or specify a maximum number. Example: Enter maximum number of threads to retrieve (leave blank for no limit)", alias="max-results") 45 messages_to_fetch: Optional[List[StrictStr]] = Field(default=None, description="Messages to Fetch. Select which categories of messages to include in the import.", alias="messages-to-fetch") 46 label_ids: Optional[StrictStr] = Field(default=None, description="Label Filters. Include emails with these labels. Example: e.g., INBOX, IMPORTANT, CATEGORY_SOCIAL", alias="label-ids") 47 __properties: ClassVar[List[str]] = ["from-filter-type", "to-filter-type", "cc-filter-type", "subject-filter-type", "label-filter-type", "from", "to", "cc", "include-attachments", "subject", "start-date", "end-date", "max-results", "messages-to-fetch", "label-ids"] 48 49 @field_validator('var_from') 50 def var_from_validate_regular_expression(cls, value): 51 """Validates the regular expression""" 52 if value is None: 53 return value 54 55 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 56 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 57 return value 58 59 @field_validator('to') 60 def to_validate_regular_expression(cls, value): 61 """Validates the regular expression""" 62 if value is None: 63 return value 64 65 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 66 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 67 return value 68 69 @field_validator('cc') 70 def cc_validate_regular_expression(cls, value): 71 """Validates the regular expression""" 72 if value is None: 73 return value 74 75 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 76 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 77 return value 78 79 @field_validator('messages_to_fetch') 80 def messages_to_fetch_validate_enum(cls, value): 81 """Validates the enum""" 82 if value is None: 83 return value 84 85 for i in value: 86 if i not in set(['all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important']): 87 raise ValueError("each list item must be one of ('all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important')") 88 return value 89 90 model_config = ConfigDict( 91 populate_by_name=True, 92 validate_assignment=True, 93 protected_namespaces=(), 94 ) 95 96 97 def to_str(self) -> str: 98 """Returns the string representation of the model using alias""" 99 return pprint.pformat(self.model_dump(by_alias=True)) 100 101 def to_json(self) -> str: 102 """Returns the JSON representation of the model using alias""" 103 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 104 return json.dumps(self.to_dict()) 105 106 @classmethod 107 def from_json(cls, json_str: str) -> Optional[Self]: 108 """Create an instance of GMAILConfig from a JSON string""" 109 return cls.from_dict(json.loads(json_str)) 110 111 def to_dict(self) -> Dict[str, Any]: 112 """Return the dictionary representation of the model using alias. 113 114 This has the following differences from calling pydantic's 115 `self.model_dump(by_alias=True)`: 116 117 * `None` is only added to the output dict for nullable fields that 118 were set at model initialization. Other fields with value `None` 119 are ignored. 120 """ 121 excluded_fields: Set[str] = set([ 122 ]) 123 124 _dict = self.model_dump( 125 by_alias=True, 126 exclude=excluded_fields, 127 exclude_none=True, 128 ) 129 return _dict 130 131 @classmethod 132 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 133 """Create an instance of GMAILConfig from a dict""" 134 if obj is None: 135 return None 136 137 if not isinstance(obj, dict): 138 return cls.model_validate(obj) 139 140 _obj = cls.model_validate({ 141 "from-filter-type": obj.get("from-filter-type") if obj.get("from-filter-type") is not None else 'OR', 142 "to-filter-type": obj.get("to-filter-type") if obj.get("to-filter-type") is not None else 'OR', 143 "cc-filter-type": obj.get("cc-filter-type") if obj.get("cc-filter-type") is not None else 'OR', 144 "subject-filter-type": obj.get("subject-filter-type") if obj.get("subject-filter-type") is not None else 'AND', 145 "label-filter-type": obj.get("label-filter-type") if obj.get("label-filter-type") is not None else 'AND', 146 "from": obj.get("from"), 147 "to": obj.get("to"), 148 "cc": obj.get("cc"), 149 "include-attachments": obj.get("include-attachments") if obj.get("include-attachments") is not None else False, 150 "subject": obj.get("subject"), 151 "start-date": obj.get("start-date"), 152 "end-date": obj.get("end-date"), 153 "max-results": obj.get("max-results"), 154 "messages-to-fetch": obj.get("messages-to-fetch"), 155 "label-ids": obj.get("label-ids") 156 }) 157 return _obj
Configuration for Gmail connector
From Address Filter. Only include emails from these senders. Example: Add sender email(s)
To Address Filter. Only include emails sent to these recipients. Example: Add recipient email(s)
CC Address Filter. Only include emails with these addresses in CC field. Example: Add CC email(s)
Include Attachments. Include email attachments in the processed content
Subject Filter. Include emails with these keywords in the subject line. Example: Add subject keywords
Start Date. Only include emails sent after this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-01
End Date. Only include emails sent before this date (exclusive). Format: YYYY-MM-DD.. Example: e.g., 2024-01-31
Maximum Results. Leave blank for no limit, or specify a maximum number. Example: Enter maximum number of threads to retrieve (leave blank for no limit)
Messages to Fetch. Select which categories of messages to include in the import.
Label Filters. Include emails with these labels. Example: e.g., INBOX, IMPORTANT, CATEGORY_SOCIAL
49 @field_validator('var_from') 50 def var_from_validate_regular_expression(cls, value): 51 """Validates the regular expression""" 52 if value is None: 53 return value 54 55 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 56 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 57 return value
Validates the regular expression
59 @field_validator('to') 60 def to_validate_regular_expression(cls, value): 61 """Validates the regular expression""" 62 if value is None: 63 return value 64 65 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 66 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 67 return value
Validates the regular expression
69 @field_validator('cc') 70 def cc_validate_regular_expression(cls, value): 71 """Validates the regular expression""" 72 if value is None: 73 return value 74 75 if not re.match(r"^[^\s@]+@[^\s@]+\.[^\s@]+$", value): 76 raise ValueError(r"must validate the regular expression /^[^\s@]+@[^\s@]+\.[^\s@]+$/") 77 return value
Validates the regular expression
79 @field_validator('messages_to_fetch') 80 def messages_to_fetch_validate_enum(cls, value): 81 """Validates the enum""" 82 if value is None: 83 return value 84 85 for i in value: 86 if i not in set(['all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important']): 87 raise ValueError("each list item must be one of ('all', 'inbox', 'sent', 'archive', 'spam-trash', 'unread', 'starred', 'important')") 88 return value
Validates the enum
97 def to_str(self) -> str: 98 """Returns the string representation of the model using alias""" 99 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
101 def to_json(self) -> str: 102 """Returns the JSON representation of the model using alias""" 103 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 104 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
106 @classmethod 107 def from_json(cls, json_str: str) -> Optional[Self]: 108 """Create an instance of GMAILConfig from a JSON string""" 109 return cls.from_dict(json.loads(json_str))
Create an instance of GMAILConfig from a JSON string
111 def to_dict(self) -> Dict[str, Any]: 112 """Return the dictionary representation of the model using alias. 113 114 This has the following differences from calling pydantic's 115 `self.model_dump(by_alias=True)`: 116 117 * `None` is only added to the output dict for nullable fields that 118 were set at model initialization. Other fields with value `None` 119 are ignored. 120 """ 121 excluded_fields: Set[str] = set([ 122 ]) 123 124 _dict = self.model_dump( 125 by_alias=True, 126 exclude=excluded_fields, 127 exclude_none=True, 128 ) 129 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):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.
131 @classmethod 132 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 133 """Create an instance of GMAILConfig from a dict""" 134 if obj is None: 135 return None 136 137 if not isinstance(obj, dict): 138 return cls.model_validate(obj) 139 140 _obj = cls.model_validate({ 141 "from-filter-type": obj.get("from-filter-type") if obj.get("from-filter-type") is not None else 'OR', 142 "to-filter-type": obj.get("to-filter-type") if obj.get("to-filter-type") is not None else 'OR', 143 "cc-filter-type": obj.get("cc-filter-type") if obj.get("cc-filter-type") is not None else 'OR', 144 "subject-filter-type": obj.get("subject-filter-type") if obj.get("subject-filter-type") is not None else 'AND', 145 "label-filter-type": obj.get("label-filter-type") if obj.get("label-filter-type") is not None else 'AND', 146 "from": obj.get("from"), 147 "to": obj.get("to"), 148 "cc": obj.get("cc"), 149 "include-attachments": obj.get("include-attachments") if obj.get("include-attachments") is not None else False, 150 "subject": obj.get("subject"), 151 "start-date": obj.get("start-date"), 152 "end-date": obj.get("end-date"), 153 "max-results": obj.get("max-results"), 154 "messages-to-fetch": obj.get("messages-to-fetch"), 155 "label-ids": obj.get("label-ids") 156 }) 157 return _obj
Create an instance of GMAILConfig from a dict