vectorize_client.models.update_user_in_source_connector_request

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
21from typing import Any, ClassVar, Dict, List, Optional
22from vectorize_client.models.add_user_to_source_connector_request_selected_files import AddUserToSourceConnectorRequestSelectedFiles
23from typing import Optional, Set
24from typing_extensions import Self
25
26class UpdateUserInSourceConnectorRequest(BaseModel):
27    """
28    UpdateUserInSourceConnectorRequest
29    """ # noqa: E501
30    user_id: StrictStr = Field(alias="userId")
31    selected_files: Optional[AddUserToSourceConnectorRequestSelectedFiles] = Field(default=None, alias="selectedFiles")
32    refresh_token: Optional[StrictStr] = Field(default=None, alias="refreshToken")
33    access_token: Optional[StrictStr] = Field(default=None, alias="accessToken")
34    __properties: ClassVar[List[str]] = ["userId", "selectedFiles", "refreshToken", "accessToken"]
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 UpdateUserInSourceConnectorRequest 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        # override the default output from pydantic by calling `to_dict()` of selected_files
76        if self.selected_files:
77            _dict['selectedFiles'] = self.selected_files.to_dict()
78        return _dict
79
80    @classmethod
81    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82        """Create an instance of UpdateUserInSourceConnectorRequest from a dict"""
83        if obj is None:
84            return None
85
86        if not isinstance(obj, dict):
87            return cls.model_validate(obj)
88
89        _obj = cls.model_validate({
90            "userId": obj.get("userId"),
91            "selectedFiles": AddUserToSourceConnectorRequestSelectedFiles.from_dict(obj["selectedFiles"]) if obj.get("selectedFiles") is not None else None,
92            "refreshToken": obj.get("refreshToken"),
93            "accessToken": obj.get("accessToken")
94        })
95        return _obj
class UpdateUserInSourceConnectorRequest(pydantic.main.BaseModel):
27class UpdateUserInSourceConnectorRequest(BaseModel):
28    """
29    UpdateUserInSourceConnectorRequest
30    """ # noqa: E501
31    user_id: StrictStr = Field(alias="userId")
32    selected_files: Optional[AddUserToSourceConnectorRequestSelectedFiles] = Field(default=None, alias="selectedFiles")
33    refresh_token: Optional[StrictStr] = Field(default=None, alias="refreshToken")
34    access_token: Optional[StrictStr] = Field(default=None, alias="accessToken")
35    __properties: ClassVar[List[str]] = ["userId", "selectedFiles", "refreshToken", "accessToken"]
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 UpdateUserInSourceConnectorRequest 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        # override the default output from pydantic by calling `to_dict()` of selected_files
77        if self.selected_files:
78            _dict['selectedFiles'] = self.selected_files.to_dict()
79        return _dict
80
81    @classmethod
82    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83        """Create an instance of UpdateUserInSourceConnectorRequest 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            "userId": obj.get("userId"),
92            "selectedFiles": AddUserToSourceConnectorRequestSelectedFiles.from_dict(obj["selectedFiles"]) if obj.get("selectedFiles") is not None else None,
93            "refreshToken": obj.get("refreshToken"),
94            "accessToken": obj.get("accessToken")
95        })
96        return _obj

UpdateUserInSourceConnectorRequest

user_id: typing.Annotated[str, Strict(strict=True)]
refresh_token: Optional[Annotated[str, Strict(strict=True)]]
access_token: Optional[Annotated[str, Strict(strict=True)]]
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:
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 UpdateUserInSourceConnectorRequest from a JSON string"""
56        return cls.from_dict(json.loads(json_str))

Create an instance of UpdateUserInSourceConnectorRequest 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        # override the default output from pydantic by calling `to_dict()` of selected_files
77        if self.selected_files:
78            _dict['selectedFiles'] = self.selected_files.to_dict()
79        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]:
81    @classmethod
82    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83        """Create an instance of UpdateUserInSourceConnectorRequest 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            "userId": obj.get("userId"),
92            "selectedFiles": AddUserToSourceConnectorRequestSelectedFiles.from_dict(obj["selectedFiles"]) if obj.get("selectedFiles") is not None else None,
93            "refreshToken": obj.get("refreshToken"),
94            "accessToken": obj.get("accessToken")
95        })
96        return _obj

Create an instance of UpdateUserInSourceConnectorRequest from a dict