vectorize_client.models.intercom_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, StrictStr, field_validator
 22from typing import Any, ClassVar, Dict, List, Optional
 23from typing import Optional, Set
 24from typing_extensions import Self
 25
 26class INTERCOMConfig(BaseModel):
 27    """
 28    Configuration for Intercom connector
 29    """ # noqa: E501
 30    created_at: date = Field(description="Created After. Filter for conversations created after this date. Example: Enter a date: Example 2012-12-31")
 31    updated_at: Optional[date] = Field(default=None, description="Updated After. Filter for conversations updated after this date. Example: Enter a date: Example 2012-12-31")
 32    state: Optional[List[StrictStr]] = Field(default=None, description="State")
 33    __properties: ClassVar[List[str]] = ["created_at", "updated_at", "state"]
 34
 35    @field_validator('state')
 36    def state_validate_enum(cls, value):
 37        """Validates the enum"""
 38        if value is None:
 39            return value
 40
 41        for i in value:
 42            if i not in set(['open', 'closed', 'snoozed']):
 43                raise ValueError("each list item must be one of ('open', 'closed', 'snoozed')")
 44        return value
 45
 46    model_config = ConfigDict(
 47        populate_by_name=True,
 48        validate_assignment=True,
 49        protected_namespaces=(),
 50    )
 51
 52
 53    def to_str(self) -> str:
 54        """Returns the string representation of the model using alias"""
 55        return pprint.pformat(self.model_dump(by_alias=True))
 56
 57    def to_json(self) -> str:
 58        """Returns the JSON representation of the model using alias"""
 59        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 60        return json.dumps(self.to_dict())
 61
 62    @classmethod
 63    def from_json(cls, json_str: str) -> Optional[Self]:
 64        """Create an instance of INTERCOMConfig from a JSON string"""
 65        return cls.from_dict(json.loads(json_str))
 66
 67    def to_dict(self) -> Dict[str, Any]:
 68        """Return the dictionary representation of the model using alias.
 69
 70        This has the following differences from calling pydantic's
 71        `self.model_dump(by_alias=True)`:
 72
 73        * `None` is only added to the output dict for nullable fields that
 74          were set at model initialization. Other fields with value `None`
 75          are ignored.
 76        """
 77        excluded_fields: Set[str] = set([
 78        ])
 79
 80        _dict = self.model_dump(
 81            by_alias=True,
 82            exclude=excluded_fields,
 83            exclude_none=True,
 84        )
 85        return _dict
 86
 87    @classmethod
 88    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 89        """Create an instance of INTERCOMConfig 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            "created_at": obj.get("created_at"),
 98            "updated_at": obj.get("updated_at"),
 99            "state": obj.get("state")
100        })
101        return _obj
class INTERCOMConfig(pydantic.main.BaseModel):
 27class INTERCOMConfig(BaseModel):
 28    """
 29    Configuration for Intercom connector
 30    """ # noqa: E501
 31    created_at: date = Field(description="Created After. Filter for conversations created after this date. Example: Enter a date: Example 2012-12-31")
 32    updated_at: Optional[date] = Field(default=None, description="Updated After. Filter for conversations updated after this date. Example: Enter a date: Example 2012-12-31")
 33    state: Optional[List[StrictStr]] = Field(default=None, description="State")
 34    __properties: ClassVar[List[str]] = ["created_at", "updated_at", "state"]
 35
 36    @field_validator('state')
 37    def state_validate_enum(cls, value):
 38        """Validates the enum"""
 39        if value is None:
 40            return value
 41
 42        for i in value:
 43            if i not in set(['open', 'closed', 'snoozed']):
 44                raise ValueError("each list item must be one of ('open', 'closed', 'snoozed')")
 45        return value
 46
 47    model_config = ConfigDict(
 48        populate_by_name=True,
 49        validate_assignment=True,
 50        protected_namespaces=(),
 51    )
 52
 53
 54    def to_str(self) -> str:
 55        """Returns the string representation of the model using alias"""
 56        return pprint.pformat(self.model_dump(by_alias=True))
 57
 58    def to_json(self) -> str:
 59        """Returns the JSON representation of the model using alias"""
 60        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
 61        return json.dumps(self.to_dict())
 62
 63    @classmethod
 64    def from_json(cls, json_str: str) -> Optional[Self]:
 65        """Create an instance of INTERCOMConfig from a JSON string"""
 66        return cls.from_dict(json.loads(json_str))
 67
 68    def to_dict(self) -> Dict[str, Any]:
 69        """Return the dictionary representation of the model using alias.
 70
 71        This has the following differences from calling pydantic's
 72        `self.model_dump(by_alias=True)`:
 73
 74        * `None` is only added to the output dict for nullable fields that
 75          were set at model initialization. Other fields with value `None`
 76          are ignored.
 77        """
 78        excluded_fields: Set[str] = set([
 79        ])
 80
 81        _dict = self.model_dump(
 82            by_alias=True,
 83            exclude=excluded_fields,
 84            exclude_none=True,
 85        )
 86        return _dict
 87
 88    @classmethod
 89    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 90        """Create an instance of INTERCOMConfig from a dict"""
 91        if obj is None:
 92            return None
 93
 94        if not isinstance(obj, dict):
 95            return cls.model_validate(obj)
 96
 97        _obj = cls.model_validate({
 98            "created_at": obj.get("created_at"),
 99            "updated_at": obj.get("updated_at"),
100            "state": obj.get("state")
101        })
102        return _obj

Configuration for Intercom connector

created_at: datetime.date
updated_at: Optional[datetime.date]
state: Optional[List[Annotated[str, Strict(strict=True)]]]
@field_validator('state')
def state_validate_enum(cls, value):
36    @field_validator('state')
37    def state_validate_enum(cls, value):
38        """Validates the enum"""
39        if value is None:
40            return value
41
42        for i in value:
43            if i not in set(['open', 'closed', 'snoozed']):
44                raise ValueError("each list item must be one of ('open', 'closed', 'snoozed')")
45        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:
54    def to_str(self) -> str:
55        """Returns the string representation of the model using alias"""
56        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
58    def to_json(self) -> str:
59        """Returns the JSON representation of the model using alias"""
60        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61        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]:
63    @classmethod
64    def from_json(cls, json_str: str) -> Optional[Self]:
65        """Create an instance of INTERCOMConfig from a JSON string"""
66        return cls.from_dict(json.loads(json_str))

Create an instance of INTERCOMConfig from a JSON string

def to_dict(self) -> Dict[str, Any]:
68    def to_dict(self) -> Dict[str, Any]:
69        """Return the dictionary representation of the model using alias.
70
71        This has the following differences from calling pydantic's
72        `self.model_dump(by_alias=True)`:
73
74        * `None` is only added to the output dict for nullable fields that
75          were set at model initialization. Other fields with value `None`
76          are ignored.
77        """
78        excluded_fields: Set[str] = set([
79        ])
80
81        _dict = self.model_dump(
82            by_alias=True,
83            exclude=excluded_fields,
84            exclude_none=True,
85        )
86        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 value None are ignored.
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 88    @classmethod
 89    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
 90        """Create an instance of INTERCOMConfig from a dict"""
 91        if obj is None:
 92            return None
 93
 94        if not isinstance(obj, dict):
 95            return cls.model_validate(obj)
 96
 97        _obj = cls.model_validate({
 98            "created_at": obj.get("created_at"),
 99            "updated_at": obj.get("updated_at"),
100            "state": obj.get("state")
101        })
102        return _obj

Create an instance of INTERCOMConfig from a dict