vectorize_client.models.get_source_connectors200_response

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
21from typing import Any, ClassVar, Dict, List
22from vectorize_client.models.source_connector import SourceConnector
23from typing import Optional, Set
24from typing_extensions import Self
25
26class GetSourceConnectors200Response(BaseModel):
27    """
28    GetSourceConnectors200Response
29    """ # noqa: E501
30    source_connectors: List[SourceConnector] = Field(alias="sourceConnectors")
31    __properties: ClassVar[List[str]] = ["sourceConnectors"]
32
33    model_config = ConfigDict(
34        populate_by_name=True,
35        validate_assignment=True,
36        protected_namespaces=(),
37    )
38
39
40    def to_str(self) -> str:
41        """Returns the string representation of the model using alias"""
42        return pprint.pformat(self.model_dump(by_alias=True))
43
44    def to_json(self) -> str:
45        """Returns the JSON representation of the model using alias"""
46        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47        return json.dumps(self.to_dict())
48
49    @classmethod
50    def from_json(cls, json_str: str) -> Optional[Self]:
51        """Create an instance of GetSourceConnectors200Response from a JSON string"""
52        return cls.from_dict(json.loads(json_str))
53
54    def to_dict(self) -> Dict[str, Any]:
55        """Return the dictionary representation of the model using alias.
56
57        This has the following differences from calling pydantic's
58        `self.model_dump(by_alias=True)`:
59
60        * `None` is only added to the output dict for nullable fields that
61          were set at model initialization. Other fields with value `None`
62          are ignored.
63        """
64        excluded_fields: Set[str] = set([
65        ])
66
67        _dict = self.model_dump(
68            by_alias=True,
69            exclude=excluded_fields,
70            exclude_none=True,
71        )
72        # override the default output from pydantic by calling `to_dict()` of each item in source_connectors (list)
73        _items = []
74        if self.source_connectors:
75            for _item_source_connectors in self.source_connectors:
76                if _item_source_connectors:
77                    _items.append(_item_source_connectors.to_dict())
78            _dict['sourceConnectors'] = _items
79        return _dict
80
81    @classmethod
82    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83        """Create an instance of GetSourceConnectors200Response from a dict"""
84        if obj is None:
85            return None
86
87        if not isinstance(obj, dict):
88            return cls.model_validate(obj)
89
90        _obj = cls.model_validate({
91            "sourceConnectors": [SourceConnector.from_dict(_item) for _item in obj["sourceConnectors"]] if obj.get("sourceConnectors") is not None else None
92        })
93        return _obj
class GetSourceConnectors200Response(pydantic.main.BaseModel):
27class GetSourceConnectors200Response(BaseModel):
28    """
29    GetSourceConnectors200Response
30    """ # noqa: E501
31    source_connectors: List[SourceConnector] = Field(alias="sourceConnectors")
32    __properties: ClassVar[List[str]] = ["sourceConnectors"]
33
34    model_config = ConfigDict(
35        populate_by_name=True,
36        validate_assignment=True,
37        protected_namespaces=(),
38    )
39
40
41    def to_str(self) -> str:
42        """Returns the string representation of the model using alias"""
43        return pprint.pformat(self.model_dump(by_alias=True))
44
45    def to_json(self) -> str:
46        """Returns the JSON representation of the model using alias"""
47        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48        return json.dumps(self.to_dict())
49
50    @classmethod
51    def from_json(cls, json_str: str) -> Optional[Self]:
52        """Create an instance of GetSourceConnectors200Response from a JSON string"""
53        return cls.from_dict(json.loads(json_str))
54
55    def to_dict(self) -> Dict[str, Any]:
56        """Return the dictionary representation of the model using alias.
57
58        This has the following differences from calling pydantic's
59        `self.model_dump(by_alias=True)`:
60
61        * `None` is only added to the output dict for nullable fields that
62          were set at model initialization. Other fields with value `None`
63          are ignored.
64        """
65        excluded_fields: Set[str] = set([
66        ])
67
68        _dict = self.model_dump(
69            by_alias=True,
70            exclude=excluded_fields,
71            exclude_none=True,
72        )
73        # override the default output from pydantic by calling `to_dict()` of each item in source_connectors (list)
74        _items = []
75        if self.source_connectors:
76            for _item_source_connectors in self.source_connectors:
77                if _item_source_connectors:
78                    _items.append(_item_source_connectors.to_dict())
79            _dict['sourceConnectors'] = _items
80        return _dict
81
82    @classmethod
83    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84        """Create an instance of GetSourceConnectors200Response 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            "sourceConnectors": [SourceConnector.from_dict(_item) for _item in obj["sourceConnectors"]] if obj.get("sourceConnectors") is not None else None
93        })
94        return _obj

GetSourceConnectors200Response

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:
41    def to_str(self) -> str:
42        """Returns the string representation of the model using alias"""
43        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

def to_json(self) -> str:
45    def to_json(self) -> str:
46        """Returns the JSON representation of the model using alias"""
47        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48        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]:
50    @classmethod
51    def from_json(cls, json_str: str) -> Optional[Self]:
52        """Create an instance of GetSourceConnectors200Response from a JSON string"""
53        return cls.from_dict(json.loads(json_str))

Create an instance of GetSourceConnectors200Response from a JSON string

def to_dict(self) -> Dict[str, Any]:
55    def to_dict(self) -> Dict[str, Any]:
56        """Return the dictionary representation of the model using alias.
57
58        This has the following differences from calling pydantic's
59        `self.model_dump(by_alias=True)`:
60
61        * `None` is only added to the output dict for nullable fields that
62          were set at model initialization. Other fields with value `None`
63          are ignored.
64        """
65        excluded_fields: Set[str] = set([
66        ])
67
68        _dict = self.model_dump(
69            by_alias=True,
70            exclude=excluded_fields,
71            exclude_none=True,
72        )
73        # override the default output from pydantic by calling `to_dict()` of each item in source_connectors (list)
74        _items = []
75        if self.source_connectors:
76            for _item_source_connectors in self.source_connectors:
77                if _item_source_connectors:
78                    _items.append(_item_source_connectors.to_dict())
79            _dict['sourceConnectors'] = _items
80        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]:
82    @classmethod
83    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84        """Create an instance of GetSourceConnectors200Response 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            "sourceConnectors": [SourceConnector.from_dict(_item) for _item in obj["sourceConnectors"]] if obj.get("sourceConnectors") is not None else None
93        })
94        return _obj

Create an instance of GetSourceConnectors200Response from a dict