vectorize_client.models.pipeline_events

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

PipelineEvents

id: typing.Annotated[str, Strict(strict=True)]
type: typing.Annotated[str, Strict(strict=True)]
timestamp: Optional[Annotated[str, Strict(strict=True)]]
details: Optional[Dict[str, Any]]
summary: Optional[Dict[str, Any]]
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:
44    def to_str(self) -> str:
45        """Returns the string representation of the model using alias"""
46        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

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

Create an instance of PipelineEvents from a JSON string

def to_dict(self) -> Dict[str, Any]:
58    def to_dict(self) -> Dict[str, Any]:
59        """Return the dictionary representation of the model using alias.
60
61        This has the following differences from calling pydantic's
62        `self.model_dump(by_alias=True)`:
63
64        * `None` is only added to the output dict for nullable fields that
65          were set at model initialization. Other fields with value `None`
66          are ignored.
67        """
68        excluded_fields: Set[str] = set([
69        ])
70
71        _dict = self.model_dump(
72            by_alias=True,
73            exclude=excluded_fields,
74            exclude_none=True,
75        )
76        # set to None if timestamp (nullable) is None
77        # and model_fields_set contains the field
78        if self.timestamp is None and "timestamp" in self.model_fields_set:
79            _dict['timestamp'] = None
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 value None 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 PipelineEvents 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            "id": obj.get("id"),
94            "type": obj.get("type"),
95            "timestamp": obj.get("timestamp"),
96            "details": obj.get("details"),
97            "summary": obj.get("summary")
98        })
99        return _obj

Create an instance of PipelineEvents from a dict