vectorize_client.models.discord_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, StrictStr, field_validator 21from typing import Any, ClassVar, Dict, List, Optional, Union 22from typing_extensions import Annotated 23from typing import Optional, Set 24from typing_extensions import Self 25 26class DISCORDConfig(BaseModel): 27 """ 28 Configuration for Discord connector 29 """ # noqa: E501 30 emoji: Optional[List[StrictStr]] = Field(default=None, description="Emoji Filter. Example: Enter custom emoji filter name") 31 author: Optional[List[StrictStr]] = Field(default=None, description="Author Filter. Example: Enter author name") 32 ignore_author: Optional[List[StrictStr]] = Field(default=None, description="Ignore Author Filter. Example: Enter ignore author name", alias="ignore-author") 33 limit: Optional[Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]]] = Field(default=10000, description="Limit. Example: Enter limit") 34 thread_message_inclusion: Optional[StrictStr] = Field(default='ALL', description="Thread Message Inclusion", alias="thread-message-inclusion") 35 filter_logic: Optional[StrictStr] = Field(default='AND', description="Filter Logic", alias="filter-logic") 36 thread_message_mode: Optional[StrictStr] = Field(default='CONCATENATE', description="Thread Message Mode", alias="thread-message-mode") 37 __properties: ClassVar[List[str]] = ["emoji", "author", "ignore-author", "limit", "thread-message-inclusion", "filter-logic", "thread-message-mode"] 38 39 @field_validator('thread_message_inclusion') 40 def thread_message_inclusion_validate_enum(cls, value): 41 """Validates the enum""" 42 if value is None: 43 return value 44 45 if value not in set(['ALL', 'FILTER']): 46 raise ValueError("must be one of enum values ('ALL', 'FILTER')") 47 return value 48 49 @field_validator('filter_logic') 50 def filter_logic_validate_enum(cls, value): 51 """Validates the enum""" 52 if value is None: 53 return value 54 55 if value not in set(['AND', 'OR']): 56 raise ValueError("must be one of enum values ('AND', 'OR')") 57 return value 58 59 @field_validator('thread_message_mode') 60 def thread_message_mode_validate_enum(cls, value): 61 """Validates the enum""" 62 if value is None: 63 return value 64 65 if value not in set(['CONCATENATE', 'SINGLE']): 66 raise ValueError("must be one of enum values ('CONCATENATE', 'SINGLE')") 67 return value 68 69 model_config = ConfigDict( 70 populate_by_name=True, 71 validate_assignment=True, 72 protected_namespaces=(), 73 ) 74 75 76 def to_str(self) -> str: 77 """Returns the string representation of the model using alias""" 78 return pprint.pformat(self.model_dump(by_alias=True)) 79 80 def to_json(self) -> str: 81 """Returns the JSON representation of the model using alias""" 82 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 83 return json.dumps(self.to_dict()) 84 85 @classmethod 86 def from_json(cls, json_str: str) -> Optional[Self]: 87 """Create an instance of DISCORDConfig from a JSON string""" 88 return cls.from_dict(json.loads(json_str)) 89 90 def to_dict(self) -> Dict[str, Any]: 91 """Return the dictionary representation of the model using alias. 92 93 This has the following differences from calling pydantic's 94 `self.model_dump(by_alias=True)`: 95 96 * `None` is only added to the output dict for nullable fields that 97 were set at model initialization. Other fields with value `None` 98 are ignored. 99 """ 100 excluded_fields: Set[str] = set([ 101 ]) 102 103 _dict = self.model_dump( 104 by_alias=True, 105 exclude=excluded_fields, 106 exclude_none=True, 107 ) 108 return _dict 109 110 @classmethod 111 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 112 """Create an instance of DISCORDConfig from a dict""" 113 if obj is None: 114 return None 115 116 if not isinstance(obj, dict): 117 return cls.model_validate(obj) 118 119 _obj = cls.model_validate({ 120 "emoji": obj.get("emoji"), 121 "author": obj.get("author"), 122 "ignore-author": obj.get("ignore-author"), 123 "limit": obj.get("limit") if obj.get("limit") is not None else 10000, 124 "thread-message-inclusion": obj.get("thread-message-inclusion") if obj.get("thread-message-inclusion") is not None else 'ALL', 125 "filter-logic": obj.get("filter-logic") if obj.get("filter-logic") is not None else 'AND', 126 "thread-message-mode": obj.get("thread-message-mode") if obj.get("thread-message-mode") is not None else 'CONCATENATE' 127 }) 128 return _obj
class
DISCORDConfig(pydantic.main.BaseModel):
27class DISCORDConfig(BaseModel): 28 """ 29 Configuration for Discord connector 30 """ # noqa: E501 31 emoji: Optional[List[StrictStr]] = Field(default=None, description="Emoji Filter. Example: Enter custom emoji filter name") 32 author: Optional[List[StrictStr]] = Field(default=None, description="Author Filter. Example: Enter author name") 33 ignore_author: Optional[List[StrictStr]] = Field(default=None, description="Ignore Author Filter. Example: Enter ignore author name", alias="ignore-author") 34 limit: Optional[Union[Annotated[float, Field(strict=True, ge=1)], Annotated[int, Field(strict=True, ge=1)]]] = Field(default=10000, description="Limit. Example: Enter limit") 35 thread_message_inclusion: Optional[StrictStr] = Field(default='ALL', description="Thread Message Inclusion", alias="thread-message-inclusion") 36 filter_logic: Optional[StrictStr] = Field(default='AND', description="Filter Logic", alias="filter-logic") 37 thread_message_mode: Optional[StrictStr] = Field(default='CONCATENATE', description="Thread Message Mode", alias="thread-message-mode") 38 __properties: ClassVar[List[str]] = ["emoji", "author", "ignore-author", "limit", "thread-message-inclusion", "filter-logic", "thread-message-mode"] 39 40 @field_validator('thread_message_inclusion') 41 def thread_message_inclusion_validate_enum(cls, value): 42 """Validates the enum""" 43 if value is None: 44 return value 45 46 if value not in set(['ALL', 'FILTER']): 47 raise ValueError("must be one of enum values ('ALL', 'FILTER')") 48 return value 49 50 @field_validator('filter_logic') 51 def filter_logic_validate_enum(cls, value): 52 """Validates the enum""" 53 if value is None: 54 return value 55 56 if value not in set(['AND', 'OR']): 57 raise ValueError("must be one of enum values ('AND', 'OR')") 58 return value 59 60 @field_validator('thread_message_mode') 61 def thread_message_mode_validate_enum(cls, value): 62 """Validates the enum""" 63 if value is None: 64 return value 65 66 if value not in set(['CONCATENATE', 'SINGLE']): 67 raise ValueError("must be one of enum values ('CONCATENATE', 'SINGLE')") 68 return value 69 70 model_config = ConfigDict( 71 populate_by_name=True, 72 validate_assignment=True, 73 protected_namespaces=(), 74 ) 75 76 77 def to_str(self) -> str: 78 """Returns the string representation of the model using alias""" 79 return pprint.pformat(self.model_dump(by_alias=True)) 80 81 def to_json(self) -> str: 82 """Returns the JSON representation of the model using alias""" 83 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 84 return json.dumps(self.to_dict()) 85 86 @classmethod 87 def from_json(cls, json_str: str) -> Optional[Self]: 88 """Create an instance of DISCORDConfig from a JSON string""" 89 return cls.from_dict(json.loads(json_str)) 90 91 def to_dict(self) -> Dict[str, Any]: 92 """Return the dictionary representation of the model using alias. 93 94 This has the following differences from calling pydantic's 95 `self.model_dump(by_alias=True)`: 96 97 * `None` is only added to the output dict for nullable fields that 98 were set at model initialization. Other fields with value `None` 99 are ignored. 100 """ 101 excluded_fields: Set[str] = set([ 102 ]) 103 104 _dict = self.model_dump( 105 by_alias=True, 106 exclude=excluded_fields, 107 exclude_none=True, 108 ) 109 return _dict 110 111 @classmethod 112 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 113 """Create an instance of DISCORDConfig from a dict""" 114 if obj is None: 115 return None 116 117 if not isinstance(obj, dict): 118 return cls.model_validate(obj) 119 120 _obj = cls.model_validate({ 121 "emoji": obj.get("emoji"), 122 "author": obj.get("author"), 123 "ignore-author": obj.get("ignore-author"), 124 "limit": obj.get("limit") if obj.get("limit") is not None else 10000, 125 "thread-message-inclusion": obj.get("thread-message-inclusion") if obj.get("thread-message-inclusion") is not None else 'ALL', 126 "filter-logic": obj.get("filter-logic") if obj.get("filter-logic") is not None else 'AND', 127 "thread-message-mode": obj.get("thread-message-mode") if obj.get("thread-message-mode") is not None else 'CONCATENATE' 128 }) 129 return _obj
Configuration for Discord connector
limit: Union[Annotated[float, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])], Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Strict(strict=True), Ge(ge=1)])], NoneType]
@field_validator('thread_message_inclusion')
def
thread_message_inclusion_validate_enum(cls, value):
40 @field_validator('thread_message_inclusion') 41 def thread_message_inclusion_validate_enum(cls, value): 42 """Validates the enum""" 43 if value is None: 44 return value 45 46 if value not in set(['ALL', 'FILTER']): 47 raise ValueError("must be one of enum values ('ALL', 'FILTER')") 48 return value
Validates the enum
@field_validator('filter_logic')
def
filter_logic_validate_enum(cls, value):
50 @field_validator('filter_logic') 51 def filter_logic_validate_enum(cls, value): 52 """Validates the enum""" 53 if value is None: 54 return value 55 56 if value not in set(['AND', 'OR']): 57 raise ValueError("must be one of enum values ('AND', 'OR')") 58 return value
Validates the enum
@field_validator('thread_message_mode')
def
thread_message_mode_validate_enum(cls, value):
60 @field_validator('thread_message_mode') 61 def thread_message_mode_validate_enum(cls, value): 62 """Validates the enum""" 63 if value is None: 64 return value 65 66 if value not in set(['CONCATENATE', 'SINGLE']): 67 raise ValueError("must be one of enum values ('CONCATENATE', 'SINGLE')") 68 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:
77 def to_str(self) -> str: 78 """Returns the string representation of the model using alias""" 79 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
81 def to_json(self) -> str: 82 """Returns the JSON representation of the model using alias""" 83 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 84 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]:
86 @classmethod 87 def from_json(cls, json_str: str) -> Optional[Self]: 88 """Create an instance of DISCORDConfig from a JSON string""" 89 return cls.from_dict(json.loads(json_str))
Create an instance of DISCORDConfig from a JSON string
def
to_dict(self) -> Dict[str, Any]:
91 def to_dict(self) -> Dict[str, Any]: 92 """Return the dictionary representation of the model using alias. 93 94 This has the following differences from calling pydantic's 95 `self.model_dump(by_alias=True)`: 96 97 * `None` is only added to the output dict for nullable fields that 98 were set at model initialization. Other fields with value `None` 99 are ignored. 100 """ 101 excluded_fields: Set[str] = set([ 102 ]) 103 104 _dict = self.model_dump( 105 by_alias=True, 106 exclude=excluded_fields, 107 exclude_none=True, 108 ) 109 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]:
111 @classmethod 112 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 113 """Create an instance of DISCORDConfig from a dict""" 114 if obj is None: 115 return None 116 117 if not isinstance(obj, dict): 118 return cls.model_validate(obj) 119 120 _obj = cls.model_validate({ 121 "emoji": obj.get("emoji"), 122 "author": obj.get("author"), 123 "ignore-author": obj.get("ignore-author"), 124 "limit": obj.get("limit") if obj.get("limit") is not None else 10000, 125 "thread-message-inclusion": obj.get("thread-message-inclusion") if obj.get("thread-message-inclusion") is not None else 'ALL', 126 "filter-logic": obj.get("filter-logic") if obj.get("filter-logic") is not None else 'AND', 127 "thread-message-mode": obj.get("thread-message-mode") if obj.get("thread-message-mode") is not None else 'CONCATENATE' 128 }) 129 return _obj
Create an instance of DISCORDConfig from a dict