dub 0.26.12__py3-none-any.whl → 0.27.1__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/analytics.py +53 -78
- dub/basesdk.py +4 -4
- dub/commissions.py +105 -156
- dub/customers.py +261 -390
- dub/domains.py +309 -472
- dub/embed_tokens.py +53 -80
- dub/events.py +53 -78
- dub/folders.py +205 -316
- dub/links.py +511 -770
- dub/models/errors/__init__.py +9 -0
- dub/models/errors/badrequest.py +12 -6
- dub/models/errors/conflict.py +12 -6
- dub/models/errors/duberror.py +26 -0
- dub/models/errors/forbidden.py +12 -6
- dub/models/errors/internalservererror.py +12 -6
- dub/models/errors/inviteexpired.py +12 -6
- dub/models/errors/no_response_error.py +13 -0
- dub/models/errors/notfound.py +12 -6
- dub/models/errors/ratelimitexceeded.py +12 -6
- dub/models/errors/responsevalidationerror.py +25 -0
- dub/models/errors/sdkerror.py +30 -14
- dub/models/errors/unauthorized.py +12 -6
- dub/models/errors/unprocessableentity.py +12 -6
- dub/models/operations/createcustomer.py +3 -0
- dub/models/operations/getcustomer.py +3 -0
- dub/models/operations/getcustomers.py +3 -0
- dub/models/operations/tracklead.py +2 -2
- dub/models/operations/tracksale.py +2 -2
- dub/models/operations/updatecustomer.py +3 -0
- dub/partners.py +255 -384
- dub/qr_codes.py +49 -74
- dub/tags.py +205 -308
- dub/track.py +105 -156
- dub/utils/serializers.py +3 -2
- dub/utils/unmarshal_json_response.py +24 -0
- dub/workspaces.py +105 -156
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/METADATA +50 -56
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/RECORD +41 -37
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/LICENSE +0 -0
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/WHEEL +0 -0
dub/qr_codes.py
CHANGED
|
@@ -5,6 +5,7 @@ from dub import utils
|
|
|
5
5
|
from dub._hooks import HookContext
|
|
6
6
|
from dub.models import errors, operations
|
|
7
7
|
from dub.types import BaseModel, OptionalNullable, UNSET
|
|
8
|
+
from dub.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, Mapping, Optional, Union, cast
|
|
9
10
|
|
|
10
11
|
|
|
@@ -97,59 +98,46 @@ class QRCodes(BaseSDK):
|
|
|
97
98
|
if utils.match_response(http_res, "200", "image/png"):
|
|
98
99
|
return http_res.text
|
|
99
100
|
if utils.match_response(http_res, "400", "application/json"):
|
|
100
|
-
response_data =
|
|
101
|
-
raise errors.BadRequest(
|
|
101
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
102
|
+
raise errors.BadRequest(response_data, http_res)
|
|
102
103
|
if utils.match_response(http_res, "401", "application/json"):
|
|
103
|
-
response_data =
|
|
104
|
-
raise errors.Unauthorized(
|
|
104
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
105
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
105
106
|
if utils.match_response(http_res, "403", "application/json"):
|
|
106
|
-
response_data =
|
|
107
|
-
raise errors.Forbidden(
|
|
107
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
108
|
+
raise errors.Forbidden(response_data, http_res)
|
|
108
109
|
if utils.match_response(http_res, "404", "application/json"):
|
|
109
|
-
response_data =
|
|
110
|
-
raise errors.NotFound(
|
|
110
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
111
|
+
raise errors.NotFound(response_data, http_res)
|
|
111
112
|
if utils.match_response(http_res, "409", "application/json"):
|
|
112
|
-
response_data =
|
|
113
|
-
raise errors.Conflict(
|
|
113
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
114
|
+
raise errors.Conflict(response_data, http_res)
|
|
114
115
|
if utils.match_response(http_res, "410", "application/json"):
|
|
115
|
-
response_data =
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
raise errors.InviteExpired(data=response_data)
|
|
116
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
117
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
119
118
|
if utils.match_response(http_res, "422", "application/json"):
|
|
120
|
-
response_data =
|
|
121
|
-
|
|
119
|
+
response_data = unmarshal_json_response(
|
|
120
|
+
errors.UnprocessableEntityData, http_res
|
|
122
121
|
)
|
|
123
|
-
raise errors.UnprocessableEntity(
|
|
122
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
124
123
|
if utils.match_response(http_res, "429", "application/json"):
|
|
125
|
-
response_data =
|
|
126
|
-
|
|
124
|
+
response_data = unmarshal_json_response(
|
|
125
|
+
errors.RateLimitExceededData, http_res
|
|
127
126
|
)
|
|
128
|
-
raise errors.RateLimitExceeded(
|
|
127
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
129
128
|
if utils.match_response(http_res, "500", "application/json"):
|
|
130
|
-
response_data =
|
|
131
|
-
|
|
129
|
+
response_data = unmarshal_json_response(
|
|
130
|
+
errors.InternalServerErrorData, http_res
|
|
132
131
|
)
|
|
133
|
-
raise errors.InternalServerError(
|
|
132
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
134
133
|
if utils.match_response(http_res, "4XX", "*"):
|
|
135
134
|
http_res_text = utils.stream_to_text(http_res)
|
|
136
|
-
raise errors.SDKError(
|
|
137
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
138
|
-
)
|
|
135
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
139
136
|
if utils.match_response(http_res, "5XX", "*"):
|
|
140
137
|
http_res_text = utils.stream_to_text(http_res)
|
|
141
|
-
raise errors.SDKError(
|
|
142
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
143
|
-
)
|
|
138
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
144
139
|
|
|
145
|
-
|
|
146
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
147
|
-
raise errors.SDKError(
|
|
148
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
149
|
-
http_res.status_code,
|
|
150
|
-
http_res_text,
|
|
151
|
-
http_res,
|
|
152
|
-
)
|
|
140
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
153
141
|
|
|
154
142
|
async def get_async(
|
|
155
143
|
self,
|
|
@@ -239,56 +227,43 @@ class QRCodes(BaseSDK):
|
|
|
239
227
|
if utils.match_response(http_res, "200", "image/png"):
|
|
240
228
|
return http_res.text
|
|
241
229
|
if utils.match_response(http_res, "400", "application/json"):
|
|
242
|
-
response_data =
|
|
243
|
-
raise errors.BadRequest(
|
|
230
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
231
|
+
raise errors.BadRequest(response_data, http_res)
|
|
244
232
|
if utils.match_response(http_res, "401", "application/json"):
|
|
245
|
-
response_data =
|
|
246
|
-
raise errors.Unauthorized(
|
|
233
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
234
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
247
235
|
if utils.match_response(http_res, "403", "application/json"):
|
|
248
|
-
response_data =
|
|
249
|
-
raise errors.Forbidden(
|
|
236
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
237
|
+
raise errors.Forbidden(response_data, http_res)
|
|
250
238
|
if utils.match_response(http_res, "404", "application/json"):
|
|
251
|
-
response_data =
|
|
252
|
-
raise errors.NotFound(
|
|
239
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
240
|
+
raise errors.NotFound(response_data, http_res)
|
|
253
241
|
if utils.match_response(http_res, "409", "application/json"):
|
|
254
|
-
response_data =
|
|
255
|
-
raise errors.Conflict(
|
|
242
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
243
|
+
raise errors.Conflict(response_data, http_res)
|
|
256
244
|
if utils.match_response(http_res, "410", "application/json"):
|
|
257
|
-
response_data =
|
|
258
|
-
|
|
259
|
-
)
|
|
260
|
-
raise errors.InviteExpired(data=response_data)
|
|
245
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
246
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
261
247
|
if utils.match_response(http_res, "422", "application/json"):
|
|
262
|
-
response_data =
|
|
263
|
-
|
|
248
|
+
response_data = unmarshal_json_response(
|
|
249
|
+
errors.UnprocessableEntityData, http_res
|
|
264
250
|
)
|
|
265
|
-
raise errors.UnprocessableEntity(
|
|
251
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
266
252
|
if utils.match_response(http_res, "429", "application/json"):
|
|
267
|
-
response_data =
|
|
268
|
-
|
|
253
|
+
response_data = unmarshal_json_response(
|
|
254
|
+
errors.RateLimitExceededData, http_res
|
|
269
255
|
)
|
|
270
|
-
raise errors.RateLimitExceeded(
|
|
256
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
271
257
|
if utils.match_response(http_res, "500", "application/json"):
|
|
272
|
-
response_data =
|
|
273
|
-
|
|
258
|
+
response_data = unmarshal_json_response(
|
|
259
|
+
errors.InternalServerErrorData, http_res
|
|
274
260
|
)
|
|
275
|
-
raise errors.InternalServerError(
|
|
261
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
276
262
|
if utils.match_response(http_res, "4XX", "*"):
|
|
277
263
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
278
|
-
raise errors.SDKError(
|
|
279
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
280
|
-
)
|
|
264
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
281
265
|
if utils.match_response(http_res, "5XX", "*"):
|
|
282
266
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
283
|
-
raise errors.SDKError(
|
|
284
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
285
|
-
)
|
|
267
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
286
268
|
|
|
287
|
-
|
|
288
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
289
|
-
raise errors.SDKError(
|
|
290
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
291
|
-
http_res.status_code,
|
|
292
|
-
http_res_text,
|
|
293
|
-
http_res,
|
|
294
|
-
)
|
|
269
|
+
raise errors.SDKError("Unexpected response received", http_res)
|