vectorize_client.models.start_file_upload_to_connector_request

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

StartFileUploadToConnectorRequest

name: typing.Annotated[str, Strict(strict=True)]
content_type: typing.Annotated[str, Strict(strict=True)]
metadata: Optional[Annotated[str, Strict(strict=True)]]
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:
42    def to_str(self) -> str:
43        """Returns the string representation of the model using alias"""
44        return pprint.pformat(self.model_dump(by_alias=True))

Returns the string representation of the model using alias

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

Create an instance of StartFileUploadToConnectorRequest from a JSON string

def to_dict(self) -> Dict[str, Any]:
56    def to_dict(self) -> Dict[str, Any]:
57        """Return the dictionary representation of the model using alias.
58
59        This has the following differences from calling pydantic's
60        `self.model_dump(by_alias=True)`:
61
62        * `None` is only added to the output dict for nullable fields that
63          were set at model initialization. Other fields with value `None`
64          are ignored.
65        """
66        excluded_fields: Set[str] = set([
67        ])
68
69        _dict = self.model_dump(
70            by_alias=True,
71            exclude=excluded_fields,
72            exclude_none=True,
73        )
74        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]:
76    @classmethod
77    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78        """Create an instance of StartFileUploadToConnectorRequest from a dict"""
79        if obj is None:
80            return None
81
82        if not isinstance(obj, dict):
83            return cls.model_validate(obj)
84
85        _obj = cls.model_validate({
86            "name": obj.get("name"),
87            "contentType": obj.get("contentType"),
88            "metadata": obj.get("metadata")
89        })
90        return _obj

Create an instance of StartFileUploadToConnectorRequest from a dict