-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapi_app_create_request.py
More file actions
187 lines (159 loc) · 6.21 KB
/
api_app_create_request.py
File metadata and controls
187 lines (159 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# coding: utf-8
"""
Dropbox Sign API
Dropbox Sign v3 API
The version of the OpenAPI document: 3.0.0
Contact: apisupport@hellosign.com
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from dropbox_sign.models.sub_o_auth import SubOAuth
from dropbox_sign.models.sub_options import SubOptions
from dropbox_sign.models.sub_white_labeling_options import SubWhiteLabelingOptions
from typing import Optional, Set
from typing_extensions import Self
from typing import Tuple, Union
import io
from pydantic import StrictBool
class ApiAppCreateRequest(BaseModel):
"""
ApiAppCreateRequest
""" # noqa: E501
domains: Annotated[List[StrictStr], Field(min_length=1, max_length=10)] = Field(
description="The domain names the ApiApp will be associated with."
)
name: StrictStr = Field(description="The name you want to assign to the ApiApp.")
callback_url: Optional[StrictStr] = Field(
default=None,
description="The URL at which the ApiApp should receive event callbacks.",
)
custom_logo_file: Optional[
Union[StrictBytes, StrictStr, io.IOBase, Tuple[StrictStr, StrictBytes, io.IOBase]]
] = Field(
default=None,
description="An image file to use as a custom logo in embedded contexts. (Only applies to some API plans)",
)
oauth: Optional[SubOAuth] = None
options: Optional[SubOptions] = None
white_labeling_options: Optional[SubWhiteLabelingOptions] = None
__properties: ClassVar[List[str]] = [
"domains",
"name",
"callback_url",
"custom_logo_file",
"oauth",
"options",
"white_labeling_options",
]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
arbitrary_types_allowed=True,
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
def to_json_form_params(
self, excluded_fields: Set[str] = None
) -> List[Tuple[str, str]]:
data: List[Tuple[str, str]] = []
for key, value in self.to_dict(excluded_fields).items():
if isinstance(value, (int, str, bool)):
data.append((key, value))
else:
data.append((key, json.dumps(value, ensure_ascii=False)))
return data
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of ApiAppCreateRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self, excluded_fields: Set[str] = None) -> Dict[str, Any]:
"""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.
"""
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of oauth
if self.oauth:
_dict["oauth"] = self.oauth.to_dict()
# override the default output from pydantic by calling `to_dict()` of options
if self.options:
_dict["options"] = self.options.to_dict()
# override the default output from pydantic by calling `to_dict()` of white_labeling_options
if self.white_labeling_options:
_dict["white_labeling_options"] = self.white_labeling_options.to_dict()
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of ApiAppCreateRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{
"domains": obj.get("domains"),
"name": obj.get("name"),
"callback_url": obj.get("callback_url"),
"custom_logo_file": obj.get("custom_logo_file"),
"oauth": (
SubOAuth.from_dict(obj["oauth"])
if obj.get("oauth") is not None
else None
),
"options": (
SubOptions.from_dict(obj["options"])
if obj.get("options") is not None
else None
),
"white_labeling_options": (
SubWhiteLabelingOptions.from_dict(obj["white_labeling_options"])
if obj.get("white_labeling_options") is not None
else None
),
}
)
return _obj
@classmethod
def init(cls, data: Any) -> Self:
"""
Attempt to instantiate and hydrate a new instance of this class
"""
if isinstance(data, str):
data = json.loads(data)
return cls.from_dict(data)
@classmethod
def openapi_types(cls) -> Dict[str, str]:
return {
"domains": "(List[str],)",
"name": "(str,)",
"callback_url": "(str,)",
"custom_logo_file": "(io.IOBase,)",
"oauth": "(SubOAuth,)",
"options": "(SubOptions,)",
"white_labeling_options": "(SubWhiteLabelingOptions,)",
}
@classmethod
def openapi_type_is_array(cls, property_name: str) -> bool:
return property_name in [
"domains",
]