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/embed_tokens.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
|
|
|
@@ -109,64 +110,50 @@ class EmbedTokens(BaseSDK):
|
|
|
109
110
|
|
|
110
111
|
response_data: Any = None
|
|
111
112
|
if utils.match_response(http_res, "201", "application/json"):
|
|
112
|
-
return
|
|
113
|
-
|
|
114
|
-
Optional[operations.CreateReferralsEmbedTokenResponseBody],
|
|
113
|
+
return unmarshal_json_response(
|
|
114
|
+
Optional[operations.CreateReferralsEmbedTokenResponseBody], http_res
|
|
115
115
|
)
|
|
116
116
|
if utils.match_response(http_res, "400", "application/json"):
|
|
117
|
-
response_data =
|
|
118
|
-
raise errors.BadRequest(
|
|
117
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
118
|
+
raise errors.BadRequest(response_data, http_res)
|
|
119
119
|
if utils.match_response(http_res, "401", "application/json"):
|
|
120
|
-
response_data =
|
|
121
|
-
raise errors.Unauthorized(
|
|
120
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
121
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
122
122
|
if utils.match_response(http_res, "403", "application/json"):
|
|
123
|
-
response_data =
|
|
124
|
-
raise errors.Forbidden(
|
|
123
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
124
|
+
raise errors.Forbidden(response_data, http_res)
|
|
125
125
|
if utils.match_response(http_res, "404", "application/json"):
|
|
126
|
-
response_data =
|
|
127
|
-
raise errors.NotFound(
|
|
126
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
127
|
+
raise errors.NotFound(response_data, http_res)
|
|
128
128
|
if utils.match_response(http_res, "409", "application/json"):
|
|
129
|
-
response_data =
|
|
130
|
-
raise errors.Conflict(
|
|
129
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
130
|
+
raise errors.Conflict(response_data, http_res)
|
|
131
131
|
if utils.match_response(http_res, "410", "application/json"):
|
|
132
|
-
response_data =
|
|
133
|
-
|
|
134
|
-
)
|
|
135
|
-
raise errors.InviteExpired(data=response_data)
|
|
132
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
133
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
136
134
|
if utils.match_response(http_res, "422", "application/json"):
|
|
137
|
-
response_data =
|
|
138
|
-
|
|
135
|
+
response_data = unmarshal_json_response(
|
|
136
|
+
errors.UnprocessableEntityData, http_res
|
|
139
137
|
)
|
|
140
|
-
raise errors.UnprocessableEntity(
|
|
138
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
141
139
|
if utils.match_response(http_res, "429", "application/json"):
|
|
142
|
-
response_data =
|
|
143
|
-
|
|
140
|
+
response_data = unmarshal_json_response(
|
|
141
|
+
errors.RateLimitExceededData, http_res
|
|
144
142
|
)
|
|
145
|
-
raise errors.RateLimitExceeded(
|
|
143
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
146
144
|
if utils.match_response(http_res, "500", "application/json"):
|
|
147
|
-
response_data =
|
|
148
|
-
|
|
145
|
+
response_data = unmarshal_json_response(
|
|
146
|
+
errors.InternalServerErrorData, http_res
|
|
149
147
|
)
|
|
150
|
-
raise errors.InternalServerError(
|
|
148
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
151
149
|
if utils.match_response(http_res, "4XX", "*"):
|
|
152
150
|
http_res_text = utils.stream_to_text(http_res)
|
|
153
|
-
raise errors.SDKError(
|
|
154
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
155
|
-
)
|
|
151
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
156
152
|
if utils.match_response(http_res, "5XX", "*"):
|
|
157
153
|
http_res_text = utils.stream_to_text(http_res)
|
|
158
|
-
raise errors.SDKError(
|
|
159
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
160
|
-
)
|
|
154
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
161
155
|
|
|
162
|
-
|
|
163
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
164
|
-
raise errors.SDKError(
|
|
165
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
166
|
-
http_res.status_code,
|
|
167
|
-
http_res_text,
|
|
168
|
-
http_res,
|
|
169
|
-
)
|
|
156
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
170
157
|
|
|
171
158
|
async def referrals_async(
|
|
172
159
|
self,
|
|
@@ -268,61 +255,47 @@ class EmbedTokens(BaseSDK):
|
|
|
268
255
|
|
|
269
256
|
response_data: Any = None
|
|
270
257
|
if utils.match_response(http_res, "201", "application/json"):
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
Optional[operations.CreateReferralsEmbedTokenResponseBody],
|
|
258
|
+
return unmarshal_json_response(
|
|
259
|
+
Optional[operations.CreateReferralsEmbedTokenResponseBody], http_res
|
|
274
260
|
)
|
|
275
261
|
if utils.match_response(http_res, "400", "application/json"):
|
|
276
|
-
response_data =
|
|
277
|
-
raise errors.BadRequest(
|
|
262
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
263
|
+
raise errors.BadRequest(response_data, http_res)
|
|
278
264
|
if utils.match_response(http_res, "401", "application/json"):
|
|
279
|
-
response_data =
|
|
280
|
-
raise errors.Unauthorized(
|
|
265
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
266
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
281
267
|
if utils.match_response(http_res, "403", "application/json"):
|
|
282
|
-
response_data =
|
|
283
|
-
raise errors.Forbidden(
|
|
268
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
269
|
+
raise errors.Forbidden(response_data, http_res)
|
|
284
270
|
if utils.match_response(http_res, "404", "application/json"):
|
|
285
|
-
response_data =
|
|
286
|
-
raise errors.NotFound(
|
|
271
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
272
|
+
raise errors.NotFound(response_data, http_res)
|
|
287
273
|
if utils.match_response(http_res, "409", "application/json"):
|
|
288
|
-
response_data =
|
|
289
|
-
raise errors.Conflict(
|
|
274
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
275
|
+
raise errors.Conflict(response_data, http_res)
|
|
290
276
|
if utils.match_response(http_res, "410", "application/json"):
|
|
291
|
-
response_data =
|
|
292
|
-
|
|
293
|
-
)
|
|
294
|
-
raise errors.InviteExpired(data=response_data)
|
|
277
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
278
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
295
279
|
if utils.match_response(http_res, "422", "application/json"):
|
|
296
|
-
response_data =
|
|
297
|
-
|
|
280
|
+
response_data = unmarshal_json_response(
|
|
281
|
+
errors.UnprocessableEntityData, http_res
|
|
298
282
|
)
|
|
299
|
-
raise errors.UnprocessableEntity(
|
|
283
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
300
284
|
if utils.match_response(http_res, "429", "application/json"):
|
|
301
|
-
response_data =
|
|
302
|
-
|
|
285
|
+
response_data = unmarshal_json_response(
|
|
286
|
+
errors.RateLimitExceededData, http_res
|
|
303
287
|
)
|
|
304
|
-
raise errors.RateLimitExceeded(
|
|
288
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
305
289
|
if utils.match_response(http_res, "500", "application/json"):
|
|
306
|
-
response_data =
|
|
307
|
-
|
|
290
|
+
response_data = unmarshal_json_response(
|
|
291
|
+
errors.InternalServerErrorData, http_res
|
|
308
292
|
)
|
|
309
|
-
raise errors.InternalServerError(
|
|
293
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
310
294
|
if utils.match_response(http_res, "4XX", "*"):
|
|
311
295
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
312
|
-
raise errors.SDKError(
|
|
313
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
314
|
-
)
|
|
296
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
315
297
|
if utils.match_response(http_res, "5XX", "*"):
|
|
316
298
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
317
|
-
raise errors.SDKError(
|
|
318
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
319
|
-
)
|
|
299
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
320
300
|
|
|
321
|
-
|
|
322
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
323
|
-
raise errors.SDKError(
|
|
324
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
325
|
-
http_res.status_code,
|
|
326
|
-
http_res_text,
|
|
327
|
-
http_res,
|
|
328
|
-
)
|
|
301
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
dub/events.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, List, Mapping, Optional, Union, cast
|
|
9
10
|
|
|
10
11
|
|
|
@@ -95,63 +96,50 @@ class Events(BaseSDK):
|
|
|
95
96
|
|
|
96
97
|
response_data: Any = None
|
|
97
98
|
if utils.match_response(http_res, "200", "application/json"):
|
|
98
|
-
return
|
|
99
|
-
|
|
99
|
+
return unmarshal_json_response(
|
|
100
|
+
Optional[List[operations.ListEventsResponseBody]], http_res
|
|
100
101
|
)
|
|
101
102
|
if utils.match_response(http_res, "400", "application/json"):
|
|
102
|
-
response_data =
|
|
103
|
-
raise errors.BadRequest(
|
|
103
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
104
|
+
raise errors.BadRequest(response_data, http_res)
|
|
104
105
|
if utils.match_response(http_res, "401", "application/json"):
|
|
105
|
-
response_data =
|
|
106
|
-
raise errors.Unauthorized(
|
|
106
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
107
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
107
108
|
if utils.match_response(http_res, "403", "application/json"):
|
|
108
|
-
response_data =
|
|
109
|
-
raise errors.Forbidden(
|
|
109
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
110
|
+
raise errors.Forbidden(response_data, http_res)
|
|
110
111
|
if utils.match_response(http_res, "404", "application/json"):
|
|
111
|
-
response_data =
|
|
112
|
-
raise errors.NotFound(
|
|
112
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
113
|
+
raise errors.NotFound(response_data, http_res)
|
|
113
114
|
if utils.match_response(http_res, "409", "application/json"):
|
|
114
|
-
response_data =
|
|
115
|
-
raise errors.Conflict(
|
|
115
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
116
|
+
raise errors.Conflict(response_data, http_res)
|
|
116
117
|
if utils.match_response(http_res, "410", "application/json"):
|
|
117
|
-
response_data =
|
|
118
|
-
|
|
119
|
-
)
|
|
120
|
-
raise errors.InviteExpired(data=response_data)
|
|
118
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
119
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
121
120
|
if utils.match_response(http_res, "422", "application/json"):
|
|
122
|
-
response_data =
|
|
123
|
-
|
|
121
|
+
response_data = unmarshal_json_response(
|
|
122
|
+
errors.UnprocessableEntityData, http_res
|
|
124
123
|
)
|
|
125
|
-
raise errors.UnprocessableEntity(
|
|
124
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
126
125
|
if utils.match_response(http_res, "429", "application/json"):
|
|
127
|
-
response_data =
|
|
128
|
-
|
|
126
|
+
response_data = unmarshal_json_response(
|
|
127
|
+
errors.RateLimitExceededData, http_res
|
|
129
128
|
)
|
|
130
|
-
raise errors.RateLimitExceeded(
|
|
129
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
131
130
|
if utils.match_response(http_res, "500", "application/json"):
|
|
132
|
-
response_data =
|
|
133
|
-
|
|
131
|
+
response_data = unmarshal_json_response(
|
|
132
|
+
errors.InternalServerErrorData, http_res
|
|
134
133
|
)
|
|
135
|
-
raise errors.InternalServerError(
|
|
134
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
136
135
|
if utils.match_response(http_res, "4XX", "*"):
|
|
137
136
|
http_res_text = utils.stream_to_text(http_res)
|
|
138
|
-
raise errors.SDKError(
|
|
139
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
140
|
-
)
|
|
137
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
141
138
|
if utils.match_response(http_res, "5XX", "*"):
|
|
142
139
|
http_res_text = utils.stream_to_text(http_res)
|
|
143
|
-
raise errors.SDKError(
|
|
144
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
145
|
-
)
|
|
140
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
149
|
-
raise errors.SDKError(
|
|
150
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
151
|
-
http_res.status_code,
|
|
152
|
-
http_res_text,
|
|
153
|
-
http_res,
|
|
154
|
-
)
|
|
142
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
155
143
|
|
|
156
144
|
async def list_async(
|
|
157
145
|
self,
|
|
@@ -239,60 +227,47 @@ class Events(BaseSDK):
|
|
|
239
227
|
|
|
240
228
|
response_data: Any = None
|
|
241
229
|
if utils.match_response(http_res, "200", "application/json"):
|
|
242
|
-
return
|
|
243
|
-
|
|
230
|
+
return unmarshal_json_response(
|
|
231
|
+
Optional[List[operations.ListEventsResponseBody]], http_res
|
|
244
232
|
)
|
|
245
233
|
if utils.match_response(http_res, "400", "application/json"):
|
|
246
|
-
response_data =
|
|
247
|
-
raise errors.BadRequest(
|
|
234
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
235
|
+
raise errors.BadRequest(response_data, http_res)
|
|
248
236
|
if utils.match_response(http_res, "401", "application/json"):
|
|
249
|
-
response_data =
|
|
250
|
-
raise errors.Unauthorized(
|
|
237
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
238
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
251
239
|
if utils.match_response(http_res, "403", "application/json"):
|
|
252
|
-
response_data =
|
|
253
|
-
raise errors.Forbidden(
|
|
240
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
241
|
+
raise errors.Forbidden(response_data, http_res)
|
|
254
242
|
if utils.match_response(http_res, "404", "application/json"):
|
|
255
|
-
response_data =
|
|
256
|
-
raise errors.NotFound(
|
|
243
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
244
|
+
raise errors.NotFound(response_data, http_res)
|
|
257
245
|
if utils.match_response(http_res, "409", "application/json"):
|
|
258
|
-
response_data =
|
|
259
|
-
raise errors.Conflict(
|
|
246
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
247
|
+
raise errors.Conflict(response_data, http_res)
|
|
260
248
|
if utils.match_response(http_res, "410", "application/json"):
|
|
261
|
-
response_data =
|
|
262
|
-
|
|
263
|
-
)
|
|
264
|
-
raise errors.InviteExpired(data=response_data)
|
|
249
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
250
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
265
251
|
if utils.match_response(http_res, "422", "application/json"):
|
|
266
|
-
response_data =
|
|
267
|
-
|
|
252
|
+
response_data = unmarshal_json_response(
|
|
253
|
+
errors.UnprocessableEntityData, http_res
|
|
268
254
|
)
|
|
269
|
-
raise errors.UnprocessableEntity(
|
|
255
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
270
256
|
if utils.match_response(http_res, "429", "application/json"):
|
|
271
|
-
response_data =
|
|
272
|
-
|
|
257
|
+
response_data = unmarshal_json_response(
|
|
258
|
+
errors.RateLimitExceededData, http_res
|
|
273
259
|
)
|
|
274
|
-
raise errors.RateLimitExceeded(
|
|
260
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
275
261
|
if utils.match_response(http_res, "500", "application/json"):
|
|
276
|
-
response_data =
|
|
277
|
-
|
|
262
|
+
response_data = unmarshal_json_response(
|
|
263
|
+
errors.InternalServerErrorData, http_res
|
|
278
264
|
)
|
|
279
|
-
raise errors.InternalServerError(
|
|
265
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
280
266
|
if utils.match_response(http_res, "4XX", "*"):
|
|
281
267
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
282
|
-
raise errors.SDKError(
|
|
283
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
284
|
-
)
|
|
268
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
285
269
|
if utils.match_response(http_res, "5XX", "*"):
|
|
286
270
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
287
|
-
raise errors.SDKError(
|
|
288
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
289
|
-
)
|
|
271
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
290
272
|
|
|
291
|
-
|
|
292
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
293
|
-
raise errors.SDKError(
|
|
294
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
295
|
-
http_res.status_code,
|
|
296
|
-
http_res_text,
|
|
297
|
-
http_res,
|
|
298
|
-
)
|
|
273
|
+
raise errors.SDKError("Unexpected response received", http_res)
|