dub 0.34.1__py3-none-any.whl → 0.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dub/_version.py +3 -3
- dub/basesdk.py +20 -6
- dub/models/components/__init__.py +108 -26
- dub/models/components/analyticsbrowsers.py +18 -1
- dub/models/components/analyticscities.py +18 -1
- dub/models/components/analyticscontinents.py +18 -1
- dub/models/components/analyticscount.py +18 -1
- dub/models/components/analyticscountries.py +20 -1
- dub/models/components/analyticsdevices.py +18 -1
- dub/models/components/analyticsos.py +18 -1
- dub/models/components/analyticsreferers.py +18 -1
- dub/models/components/analyticsrefererurls.py +18 -1
- dub/models/components/analyticsregions.py +18 -1
- dub/models/components/analyticstimeseries.py +18 -1
- dub/models/components/analyticstoplinks.py +16 -26
- dub/models/components/analyticstopurls.py +18 -1
- dub/models/components/analyticstriggers.py +18 -1
- dub/models/components/commissioncreatedevent.py +96 -64
- dub/models/components/domainschema.py +31 -50
- dub/models/components/folderschema.py +18 -19
- dub/models/components/leadcreatedevent.py +151 -134
- dub/models/components/linkclickedevent.py +57 -70
- dub/models/components/linkschema.py +63 -64
- dub/models/components/linkwebhookevent.py +43 -51
- dub/models/components/partneranalyticscount.py +18 -1
- dub/models/components/partneranalyticstimeseries.py +18 -1
- dub/models/components/partneranalyticstoplinks.py +16 -27
- dub/models/components/partnerapplicationsubmittedevent.py +42 -75
- dub/models/components/partnerenrolledevent.py +477 -83
- dub/models/components/salecreatedevent.py +152 -151
- dub/models/errors/badrequest.py +18 -1
- dub/models/errors/conflict.py +18 -1
- dub/models/errors/forbidden.py +18 -1
- dub/models/errors/internalservererror.py +18 -1
- dub/models/errors/inviteexpired.py +18 -1
- dub/models/errors/notfound.py +18 -1
- dub/models/errors/ratelimitexceeded.py +18 -1
- dub/models/errors/unauthorized.py +18 -1
- dub/models/errors/unprocessableentity.py +18 -1
- dub/models/operations/__init__.py +230 -19
- dub/models/operations/approvebountysubmission.py +71 -45
- dub/models/operations/banpartner.py +14 -19
- dub/models/operations/bulkcreatelinks.py +86 -87
- dub/models/operations/bulkupdatelinks.py +97 -82
- dub/models/operations/checkdomainstatus.py +1 -17
- dub/models/operations/createdomain.py +33 -34
- dub/models/operations/createfolder.py +18 -19
- dub/models/operations/createlink.py +86 -87
- dub/models/operations/createpartner.py +560 -168
- dub/models/operations/createpartnerlink.py +74 -85
- dub/models/operations/createreferralsembedtoken.py +99 -87
- dub/models/operations/createtag.py +18 -1
- dub/models/operations/deactivatepartner.py +65 -0
- dub/models/operations/getcustomer.py +106 -105
- dub/models/operations/getcustomers.py +123 -105
- dub/models/operations/getlinkinfo.py +18 -1
- dub/models/operations/getlinks.py +36 -1
- dub/models/operations/getlinkscount.py +32 -1
- dub/models/operations/getqrcode.py +29 -1
- dub/models/operations/gettags.py +20 -1
- dub/models/operations/listbountysubmissions.py +63 -26
- dub/models/operations/listcommissions.py +129 -64
- dub/models/operations/listdomains.py +18 -1
- dub/models/operations/listevents.py +414 -389
- dub/models/operations/listfolders.py +18 -1
- dub/models/operations/listpartners.py +510 -84
- dub/models/operations/registerdomain.py +1 -17
- dub/models/operations/rejectbountysubmission.py +71 -26
- dub/models/operations/retrieveanalytics.py +65 -66
- dub/models/operations/retrievelinks.py +30 -19
- dub/models/operations/retrievepartneranalytics.py +25 -28
- dub/models/operations/tracklead.py +38 -83
- dub/models/operations/tracksale.py +52 -95
- dub/models/operations/updatecommission.py +126 -64
- dub/models/operations/updatecustomer.py +122 -131
- dub/models/operations/updatedomain.py +50 -35
- dub/models/operations/updatefolder.py +34 -19
- dub/models/operations/updatelink.py +101 -86
- dub/models/operations/updatetag.py +34 -1
- dub/models/operations/upsertlink.py +86 -87
- dub/models/operations/upsertpartnerlink.py +72 -78
- dub/partners.py +288 -0
- dub/sdk.py +0 -3
- dub/utils/__init__.py +10 -1
- {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/METADATA +4 -8
- dub-0.35.0.dist-info/RECORD +143 -0
- dub/models/components/workspaceschema.py +0 -328
- dub/models/operations/getworkspace.py +0 -21
- dub/models/operations/updateworkspace.py +0 -78
- dub/workspaces.py +0 -561
- dub-0.34.1.dist-info/RECORD +0 -146
- {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/WHEEL +0 -0
- {dub-0.34.1.dist-info → dub-0.35.0.dist-info}/licenses/LICENSE +0 -0
dub/workspaces.py
DELETED
|
@@ -1,561 +0,0 @@
|
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
-
|
|
3
|
-
from .basesdk import BaseSDK
|
|
4
|
-
from dub import utils
|
|
5
|
-
from dub._hooks import HookContext
|
|
6
|
-
from dub.models import components, errors, operations
|
|
7
|
-
from dub.types import BaseModel, OptionalNullable, UNSET
|
|
8
|
-
from dub.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
-
from typing import Any, Mapping, Optional, Union, cast
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Workspaces(BaseSDK):
|
|
13
|
-
def get(
|
|
14
|
-
self,
|
|
15
|
-
*,
|
|
16
|
-
request: Union[
|
|
17
|
-
operations.GetWorkspaceRequest, operations.GetWorkspaceRequestTypedDict
|
|
18
|
-
],
|
|
19
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
20
|
-
server_url: Optional[str] = None,
|
|
21
|
-
timeout_ms: Optional[int] = None,
|
|
22
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
23
|
-
) -> components.WorkspaceSchema:
|
|
24
|
-
r"""Retrieve a workspace
|
|
25
|
-
|
|
26
|
-
Retrieve a workspace for the authenticated user.
|
|
27
|
-
|
|
28
|
-
:param request: The request object to send.
|
|
29
|
-
:param retries: Override the default retry configuration for this method
|
|
30
|
-
:param server_url: Override the default server URL for this method
|
|
31
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
32
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
33
|
-
"""
|
|
34
|
-
base_url = None
|
|
35
|
-
url_variables = None
|
|
36
|
-
if timeout_ms is None:
|
|
37
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
38
|
-
|
|
39
|
-
if server_url is not None:
|
|
40
|
-
base_url = server_url
|
|
41
|
-
else:
|
|
42
|
-
base_url = self._get_url(base_url, url_variables)
|
|
43
|
-
|
|
44
|
-
if not isinstance(request, BaseModel):
|
|
45
|
-
request = utils.unmarshal(request, operations.GetWorkspaceRequest)
|
|
46
|
-
request = cast(operations.GetWorkspaceRequest, request)
|
|
47
|
-
|
|
48
|
-
req = self._build_request(
|
|
49
|
-
method="GET",
|
|
50
|
-
path="/workspaces/{idOrSlug}",
|
|
51
|
-
base_url=base_url,
|
|
52
|
-
url_variables=url_variables,
|
|
53
|
-
request=request,
|
|
54
|
-
request_body_required=False,
|
|
55
|
-
request_has_path_params=True,
|
|
56
|
-
request_has_query_params=True,
|
|
57
|
-
user_agent_header="user-agent",
|
|
58
|
-
accept_header_value="application/json",
|
|
59
|
-
http_headers=http_headers,
|
|
60
|
-
security=self.sdk_configuration.security,
|
|
61
|
-
allow_empty_value=None,
|
|
62
|
-
timeout_ms=timeout_ms,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
if retries == UNSET:
|
|
66
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
67
|
-
retries = self.sdk_configuration.retry_config
|
|
68
|
-
|
|
69
|
-
retry_config = None
|
|
70
|
-
if isinstance(retries, utils.RetryConfig):
|
|
71
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
72
|
-
|
|
73
|
-
http_res = self.do_request(
|
|
74
|
-
hook_ctx=HookContext(
|
|
75
|
-
config=self.sdk_configuration,
|
|
76
|
-
base_url=base_url or "",
|
|
77
|
-
operation_id="getWorkspace",
|
|
78
|
-
oauth2_scopes=None,
|
|
79
|
-
security_source=self.sdk_configuration.security,
|
|
80
|
-
),
|
|
81
|
-
request=req,
|
|
82
|
-
error_status_codes=[
|
|
83
|
-
"400",
|
|
84
|
-
"401",
|
|
85
|
-
"403",
|
|
86
|
-
"404",
|
|
87
|
-
"409",
|
|
88
|
-
"410",
|
|
89
|
-
"422",
|
|
90
|
-
"429",
|
|
91
|
-
"4XX",
|
|
92
|
-
"500",
|
|
93
|
-
"5XX",
|
|
94
|
-
],
|
|
95
|
-
retry_config=retry_config,
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
response_data: Any = None
|
|
99
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
100
|
-
return unmarshal_json_response(components.WorkspaceSchema, http_res)
|
|
101
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
102
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
103
|
-
raise errors.BadRequest(response_data, http_res)
|
|
104
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
105
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
106
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
107
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
108
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
109
|
-
raise errors.Forbidden(response_data, http_res)
|
|
110
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
111
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
112
|
-
raise errors.NotFound(response_data, http_res)
|
|
113
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
114
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
115
|
-
raise errors.Conflict(response_data, http_res)
|
|
116
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
117
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
118
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
119
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
120
|
-
response_data = unmarshal_json_response(
|
|
121
|
-
errors.UnprocessableEntityData, http_res
|
|
122
|
-
)
|
|
123
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
124
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
125
|
-
response_data = unmarshal_json_response(
|
|
126
|
-
errors.RateLimitExceededData, http_res
|
|
127
|
-
)
|
|
128
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
129
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
130
|
-
response_data = unmarshal_json_response(
|
|
131
|
-
errors.InternalServerErrorData, http_res
|
|
132
|
-
)
|
|
133
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
134
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
135
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
136
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
137
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
138
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
139
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
140
|
-
|
|
141
|
-
raise errors.SDKError("Unexpected response received", http_res)
|
|
142
|
-
|
|
143
|
-
async def get_async(
|
|
144
|
-
self,
|
|
145
|
-
*,
|
|
146
|
-
request: Union[
|
|
147
|
-
operations.GetWorkspaceRequest, operations.GetWorkspaceRequestTypedDict
|
|
148
|
-
],
|
|
149
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
150
|
-
server_url: Optional[str] = None,
|
|
151
|
-
timeout_ms: Optional[int] = None,
|
|
152
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
153
|
-
) -> components.WorkspaceSchema:
|
|
154
|
-
r"""Retrieve a workspace
|
|
155
|
-
|
|
156
|
-
Retrieve a workspace for the authenticated user.
|
|
157
|
-
|
|
158
|
-
:param request: The request object to send.
|
|
159
|
-
:param retries: Override the default retry configuration for this method
|
|
160
|
-
:param server_url: Override the default server URL for this method
|
|
161
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
162
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
163
|
-
"""
|
|
164
|
-
base_url = None
|
|
165
|
-
url_variables = None
|
|
166
|
-
if timeout_ms is None:
|
|
167
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
168
|
-
|
|
169
|
-
if server_url is not None:
|
|
170
|
-
base_url = server_url
|
|
171
|
-
else:
|
|
172
|
-
base_url = self._get_url(base_url, url_variables)
|
|
173
|
-
|
|
174
|
-
if not isinstance(request, BaseModel):
|
|
175
|
-
request = utils.unmarshal(request, operations.GetWorkspaceRequest)
|
|
176
|
-
request = cast(operations.GetWorkspaceRequest, request)
|
|
177
|
-
|
|
178
|
-
req = self._build_request_async(
|
|
179
|
-
method="GET",
|
|
180
|
-
path="/workspaces/{idOrSlug}",
|
|
181
|
-
base_url=base_url,
|
|
182
|
-
url_variables=url_variables,
|
|
183
|
-
request=request,
|
|
184
|
-
request_body_required=False,
|
|
185
|
-
request_has_path_params=True,
|
|
186
|
-
request_has_query_params=True,
|
|
187
|
-
user_agent_header="user-agent",
|
|
188
|
-
accept_header_value="application/json",
|
|
189
|
-
http_headers=http_headers,
|
|
190
|
-
security=self.sdk_configuration.security,
|
|
191
|
-
allow_empty_value=None,
|
|
192
|
-
timeout_ms=timeout_ms,
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
if retries == UNSET:
|
|
196
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
197
|
-
retries = self.sdk_configuration.retry_config
|
|
198
|
-
|
|
199
|
-
retry_config = None
|
|
200
|
-
if isinstance(retries, utils.RetryConfig):
|
|
201
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
202
|
-
|
|
203
|
-
http_res = await self.do_request_async(
|
|
204
|
-
hook_ctx=HookContext(
|
|
205
|
-
config=self.sdk_configuration,
|
|
206
|
-
base_url=base_url or "",
|
|
207
|
-
operation_id="getWorkspace",
|
|
208
|
-
oauth2_scopes=None,
|
|
209
|
-
security_source=self.sdk_configuration.security,
|
|
210
|
-
),
|
|
211
|
-
request=req,
|
|
212
|
-
error_status_codes=[
|
|
213
|
-
"400",
|
|
214
|
-
"401",
|
|
215
|
-
"403",
|
|
216
|
-
"404",
|
|
217
|
-
"409",
|
|
218
|
-
"410",
|
|
219
|
-
"422",
|
|
220
|
-
"429",
|
|
221
|
-
"4XX",
|
|
222
|
-
"500",
|
|
223
|
-
"5XX",
|
|
224
|
-
],
|
|
225
|
-
retry_config=retry_config,
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
response_data: Any = None
|
|
229
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
230
|
-
return unmarshal_json_response(components.WorkspaceSchema, http_res)
|
|
231
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
232
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
233
|
-
raise errors.BadRequest(response_data, http_res)
|
|
234
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
235
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
236
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
237
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
238
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
239
|
-
raise errors.Forbidden(response_data, http_res)
|
|
240
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
241
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
242
|
-
raise errors.NotFound(response_data, http_res)
|
|
243
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
244
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
245
|
-
raise errors.Conflict(response_data, http_res)
|
|
246
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
247
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
248
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
249
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
250
|
-
response_data = unmarshal_json_response(
|
|
251
|
-
errors.UnprocessableEntityData, http_res
|
|
252
|
-
)
|
|
253
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
254
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
255
|
-
response_data = unmarshal_json_response(
|
|
256
|
-
errors.RateLimitExceededData, http_res
|
|
257
|
-
)
|
|
258
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
259
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
260
|
-
response_data = unmarshal_json_response(
|
|
261
|
-
errors.InternalServerErrorData, http_res
|
|
262
|
-
)
|
|
263
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
264
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
265
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
266
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
267
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
268
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
269
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
270
|
-
|
|
271
|
-
raise errors.SDKError("Unexpected response received", http_res)
|
|
272
|
-
|
|
273
|
-
def update(
|
|
274
|
-
self,
|
|
275
|
-
*,
|
|
276
|
-
id_or_slug: str,
|
|
277
|
-
request_body: Optional[
|
|
278
|
-
Union[
|
|
279
|
-
operations.UpdateWorkspaceRequestBody,
|
|
280
|
-
operations.UpdateWorkspaceRequestBodyTypedDict,
|
|
281
|
-
]
|
|
282
|
-
] = None,
|
|
283
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
284
|
-
server_url: Optional[str] = None,
|
|
285
|
-
timeout_ms: Optional[int] = None,
|
|
286
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
287
|
-
) -> components.WorkspaceSchema:
|
|
288
|
-
r"""Update a workspace
|
|
289
|
-
|
|
290
|
-
Update a workspace by ID or slug.
|
|
291
|
-
|
|
292
|
-
:param id_or_slug: The ID or slug of the workspace to update.
|
|
293
|
-
:param request_body:
|
|
294
|
-
:param retries: Override the default retry configuration for this method
|
|
295
|
-
:param server_url: Override the default server URL for this method
|
|
296
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
297
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
298
|
-
"""
|
|
299
|
-
base_url = None
|
|
300
|
-
url_variables = None
|
|
301
|
-
if timeout_ms is None:
|
|
302
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
303
|
-
|
|
304
|
-
if server_url is not None:
|
|
305
|
-
base_url = server_url
|
|
306
|
-
else:
|
|
307
|
-
base_url = self._get_url(base_url, url_variables)
|
|
308
|
-
|
|
309
|
-
request = operations.UpdateWorkspaceRequest(
|
|
310
|
-
id_or_slug=id_or_slug,
|
|
311
|
-
request_body=utils.get_pydantic_model(
|
|
312
|
-
request_body, Optional[operations.UpdateWorkspaceRequestBody]
|
|
313
|
-
),
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
req = self._build_request(
|
|
317
|
-
method="PATCH",
|
|
318
|
-
path="/workspaces/{idOrSlug}",
|
|
319
|
-
base_url=base_url,
|
|
320
|
-
url_variables=url_variables,
|
|
321
|
-
request=request,
|
|
322
|
-
request_body_required=False,
|
|
323
|
-
request_has_path_params=True,
|
|
324
|
-
request_has_query_params=True,
|
|
325
|
-
user_agent_header="user-agent",
|
|
326
|
-
accept_header_value="application/json",
|
|
327
|
-
http_headers=http_headers,
|
|
328
|
-
security=self.sdk_configuration.security,
|
|
329
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
330
|
-
request.request_body,
|
|
331
|
-
False,
|
|
332
|
-
True,
|
|
333
|
-
"json",
|
|
334
|
-
Optional[operations.UpdateWorkspaceRequestBody],
|
|
335
|
-
),
|
|
336
|
-
allow_empty_value=None,
|
|
337
|
-
timeout_ms=timeout_ms,
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
if retries == UNSET:
|
|
341
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
342
|
-
retries = self.sdk_configuration.retry_config
|
|
343
|
-
|
|
344
|
-
retry_config = None
|
|
345
|
-
if isinstance(retries, utils.RetryConfig):
|
|
346
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
347
|
-
|
|
348
|
-
http_res = self.do_request(
|
|
349
|
-
hook_ctx=HookContext(
|
|
350
|
-
config=self.sdk_configuration,
|
|
351
|
-
base_url=base_url or "",
|
|
352
|
-
operation_id="updateWorkspace",
|
|
353
|
-
oauth2_scopes=None,
|
|
354
|
-
security_source=self.sdk_configuration.security,
|
|
355
|
-
),
|
|
356
|
-
request=req,
|
|
357
|
-
error_status_codes=[
|
|
358
|
-
"400",
|
|
359
|
-
"401",
|
|
360
|
-
"403",
|
|
361
|
-
"404",
|
|
362
|
-
"409",
|
|
363
|
-
"410",
|
|
364
|
-
"422",
|
|
365
|
-
"429",
|
|
366
|
-
"4XX",
|
|
367
|
-
"500",
|
|
368
|
-
"5XX",
|
|
369
|
-
],
|
|
370
|
-
retry_config=retry_config,
|
|
371
|
-
)
|
|
372
|
-
|
|
373
|
-
response_data: Any = None
|
|
374
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
375
|
-
return unmarshal_json_response(components.WorkspaceSchema, http_res)
|
|
376
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
377
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
378
|
-
raise errors.BadRequest(response_data, http_res)
|
|
379
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
380
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
381
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
382
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
383
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
384
|
-
raise errors.Forbidden(response_data, http_res)
|
|
385
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
386
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
387
|
-
raise errors.NotFound(response_data, http_res)
|
|
388
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
389
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
390
|
-
raise errors.Conflict(response_data, http_res)
|
|
391
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
392
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
393
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
394
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
395
|
-
response_data = unmarshal_json_response(
|
|
396
|
-
errors.UnprocessableEntityData, http_res
|
|
397
|
-
)
|
|
398
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
399
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
400
|
-
response_data = unmarshal_json_response(
|
|
401
|
-
errors.RateLimitExceededData, http_res
|
|
402
|
-
)
|
|
403
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
404
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
405
|
-
response_data = unmarshal_json_response(
|
|
406
|
-
errors.InternalServerErrorData, http_res
|
|
407
|
-
)
|
|
408
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
409
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
410
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
411
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
412
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
413
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
414
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
415
|
-
|
|
416
|
-
raise errors.SDKError("Unexpected response received", http_res)
|
|
417
|
-
|
|
418
|
-
async def update_async(
|
|
419
|
-
self,
|
|
420
|
-
*,
|
|
421
|
-
id_or_slug: str,
|
|
422
|
-
request_body: Optional[
|
|
423
|
-
Union[
|
|
424
|
-
operations.UpdateWorkspaceRequestBody,
|
|
425
|
-
operations.UpdateWorkspaceRequestBodyTypedDict,
|
|
426
|
-
]
|
|
427
|
-
] = None,
|
|
428
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
429
|
-
server_url: Optional[str] = None,
|
|
430
|
-
timeout_ms: Optional[int] = None,
|
|
431
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
432
|
-
) -> components.WorkspaceSchema:
|
|
433
|
-
r"""Update a workspace
|
|
434
|
-
|
|
435
|
-
Update a workspace by ID or slug.
|
|
436
|
-
|
|
437
|
-
:param id_or_slug: The ID or slug of the workspace to update.
|
|
438
|
-
:param request_body:
|
|
439
|
-
:param retries: Override the default retry configuration for this method
|
|
440
|
-
:param server_url: Override the default server URL for this method
|
|
441
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
442
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
443
|
-
"""
|
|
444
|
-
base_url = None
|
|
445
|
-
url_variables = None
|
|
446
|
-
if timeout_ms is None:
|
|
447
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
448
|
-
|
|
449
|
-
if server_url is not None:
|
|
450
|
-
base_url = server_url
|
|
451
|
-
else:
|
|
452
|
-
base_url = self._get_url(base_url, url_variables)
|
|
453
|
-
|
|
454
|
-
request = operations.UpdateWorkspaceRequest(
|
|
455
|
-
id_or_slug=id_or_slug,
|
|
456
|
-
request_body=utils.get_pydantic_model(
|
|
457
|
-
request_body, Optional[operations.UpdateWorkspaceRequestBody]
|
|
458
|
-
),
|
|
459
|
-
)
|
|
460
|
-
|
|
461
|
-
req = self._build_request_async(
|
|
462
|
-
method="PATCH",
|
|
463
|
-
path="/workspaces/{idOrSlug}",
|
|
464
|
-
base_url=base_url,
|
|
465
|
-
url_variables=url_variables,
|
|
466
|
-
request=request,
|
|
467
|
-
request_body_required=False,
|
|
468
|
-
request_has_path_params=True,
|
|
469
|
-
request_has_query_params=True,
|
|
470
|
-
user_agent_header="user-agent",
|
|
471
|
-
accept_header_value="application/json",
|
|
472
|
-
http_headers=http_headers,
|
|
473
|
-
security=self.sdk_configuration.security,
|
|
474
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
475
|
-
request.request_body,
|
|
476
|
-
False,
|
|
477
|
-
True,
|
|
478
|
-
"json",
|
|
479
|
-
Optional[operations.UpdateWorkspaceRequestBody],
|
|
480
|
-
),
|
|
481
|
-
allow_empty_value=None,
|
|
482
|
-
timeout_ms=timeout_ms,
|
|
483
|
-
)
|
|
484
|
-
|
|
485
|
-
if retries == UNSET:
|
|
486
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
487
|
-
retries = self.sdk_configuration.retry_config
|
|
488
|
-
|
|
489
|
-
retry_config = None
|
|
490
|
-
if isinstance(retries, utils.RetryConfig):
|
|
491
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
492
|
-
|
|
493
|
-
http_res = await self.do_request_async(
|
|
494
|
-
hook_ctx=HookContext(
|
|
495
|
-
config=self.sdk_configuration,
|
|
496
|
-
base_url=base_url or "",
|
|
497
|
-
operation_id="updateWorkspace",
|
|
498
|
-
oauth2_scopes=None,
|
|
499
|
-
security_source=self.sdk_configuration.security,
|
|
500
|
-
),
|
|
501
|
-
request=req,
|
|
502
|
-
error_status_codes=[
|
|
503
|
-
"400",
|
|
504
|
-
"401",
|
|
505
|
-
"403",
|
|
506
|
-
"404",
|
|
507
|
-
"409",
|
|
508
|
-
"410",
|
|
509
|
-
"422",
|
|
510
|
-
"429",
|
|
511
|
-
"4XX",
|
|
512
|
-
"500",
|
|
513
|
-
"5XX",
|
|
514
|
-
],
|
|
515
|
-
retry_config=retry_config,
|
|
516
|
-
)
|
|
517
|
-
|
|
518
|
-
response_data: Any = None
|
|
519
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
520
|
-
return unmarshal_json_response(components.WorkspaceSchema, http_res)
|
|
521
|
-
if utils.match_response(http_res, "400", "application/json"):
|
|
522
|
-
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
523
|
-
raise errors.BadRequest(response_data, http_res)
|
|
524
|
-
if utils.match_response(http_res, "401", "application/json"):
|
|
525
|
-
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
526
|
-
raise errors.Unauthorized(response_data, http_res)
|
|
527
|
-
if utils.match_response(http_res, "403", "application/json"):
|
|
528
|
-
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
529
|
-
raise errors.Forbidden(response_data, http_res)
|
|
530
|
-
if utils.match_response(http_res, "404", "application/json"):
|
|
531
|
-
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
532
|
-
raise errors.NotFound(response_data, http_res)
|
|
533
|
-
if utils.match_response(http_res, "409", "application/json"):
|
|
534
|
-
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
535
|
-
raise errors.Conflict(response_data, http_res)
|
|
536
|
-
if utils.match_response(http_res, "410", "application/json"):
|
|
537
|
-
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
538
|
-
raise errors.InviteExpired(response_data, http_res)
|
|
539
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
540
|
-
response_data = unmarshal_json_response(
|
|
541
|
-
errors.UnprocessableEntityData, http_res
|
|
542
|
-
)
|
|
543
|
-
raise errors.UnprocessableEntity(response_data, http_res)
|
|
544
|
-
if utils.match_response(http_res, "429", "application/json"):
|
|
545
|
-
response_data = unmarshal_json_response(
|
|
546
|
-
errors.RateLimitExceededData, http_res
|
|
547
|
-
)
|
|
548
|
-
raise errors.RateLimitExceeded(response_data, http_res)
|
|
549
|
-
if utils.match_response(http_res, "500", "application/json"):
|
|
550
|
-
response_data = unmarshal_json_response(
|
|
551
|
-
errors.InternalServerErrorData, http_res
|
|
552
|
-
)
|
|
553
|
-
raise errors.InternalServerError(response_data, http_res)
|
|
554
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
555
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
556
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
557
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
558
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
559
|
-
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
560
|
-
|
|
561
|
-
raise errors.SDKError("Unexpected response received", http_res)
|