dub 0.26.12__py3-none-any.whl → 0.27.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/analytics.py +66 -76
- dub/basesdk.py +4 -4
- dub/commissions.py +132 -152
- dub/customers.py +330 -380
- dub/domains.py +396 -456
- dub/embed_tokens.py +66 -78
- dub/events.py +66 -76
- dub/folders.py +264 -304
- dub/links.py +666 -750
- 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/updatecustomer.py +3 -0
- dub/partners.py +336 -374
- dub/qr_codes.py +62 -72
- dub/tags.py +268 -300
- dub/track.py +132 -152
- dub/utils/__init__.py +3 -0
- dub/utils/serializers.py +21 -3
- dub/workspaces.py +132 -152
- {dub-0.26.12.dist-info → dub-0.27.0.dist-info}/METADATA +50 -56
- {dub-0.26.12.dist-info → dub-0.27.0.dist-info}/RECORD +39 -36
- {dub-0.26.12.dist-info → dub-0.27.0.dist-info}/LICENSE +0 -0
- {dub-0.26.12.dist-info → dub-0.27.0.dist-info}/WHEEL +0 -0
dub/embed_tokens.py
CHANGED
|
@@ -109,64 +109,58 @@ class EmbedTokens(BaseSDK):
|
|
|
109
109
|
|
|
110
110
|
response_data: Any = None
|
|
111
111
|
if utils.match_response(http_res, "201", "application/json"):
|
|
112
|
-
return utils.
|
|
113
|
-
|
|
114
|
-
Optional[operations.CreateReferralsEmbedTokenResponseBody],
|
|
112
|
+
return utils.unmarshal_json_response(
|
|
113
|
+
Optional[operations.CreateReferralsEmbedTokenResponseBody], http_res
|
|
115
114
|
)
|
|
116
115
|
if utils.match_response(http_res, "400", "application/json"):
|
|
117
|
-
response_data = utils.
|
|
118
|
-
|
|
116
|
+
response_data = utils.unmarshal_json_response(
|
|
117
|
+
errors.BadRequestData, http_res
|
|
118
|
+
)
|
|
119
|
+
raise errors.BadRequest(response_data, http_res)
|
|
119
120
|
if utils.match_response(http_res, "401", "application/json"):
|
|
120
|
-
response_data = utils.
|
|
121
|
-
|
|
121
|
+
response_data = utils.unmarshal_json_response(
|
|
122
|
+
errors.UnauthorizedData, http_res
|
|
123
|
+
)
|
|
124
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
122
125
|
if utils.match_response(http_res, "403", "application/json"):
|
|
123
|
-
response_data = utils.
|
|
124
|
-
|
|
126
|
+
response_data = utils.unmarshal_json_response(
|
|
127
|
+
errors.ForbiddenData, http_res
|
|
128
|
+
)
|
|
129
|
+
raise errors.Forbidden(response_data, http_res)
|
|
125
130
|
if utils.match_response(http_res, "404", "application/json"):
|
|
126
|
-
response_data = utils.
|
|
127
|
-
raise errors.NotFound(
|
|
131
|
+
response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
|
|
132
|
+
raise errors.NotFound(response_data, http_res)
|
|
128
133
|
if utils.match_response(http_res, "409", "application/json"):
|
|
129
|
-
response_data = utils.
|
|
130
|
-
raise errors.Conflict(
|
|
134
|
+
response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
|
|
135
|
+
raise errors.Conflict(response_data, http_res)
|
|
131
136
|
if utils.match_response(http_res, "410", "application/json"):
|
|
132
|
-
response_data = utils.
|
|
133
|
-
|
|
137
|
+
response_data = utils.unmarshal_json_response(
|
|
138
|
+
errors.InviteExpiredData, http_res
|
|
134
139
|
)
|
|
135
|
-
raise errors.InviteExpired(
|
|
140
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
136
141
|
if utils.match_response(http_res, "422", "application/json"):
|
|
137
|
-
response_data = utils.
|
|
138
|
-
|
|
142
|
+
response_data = utils.unmarshal_json_response(
|
|
143
|
+
errors.UnprocessableEntityData, http_res
|
|
139
144
|
)
|
|
140
|
-
raise errors.UnprocessableEntity(
|
|
145
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
141
146
|
if utils.match_response(http_res, "429", "application/json"):
|
|
142
|
-
response_data = utils.
|
|
143
|
-
|
|
147
|
+
response_data = utils.unmarshal_json_response(
|
|
148
|
+
errors.RateLimitExceededData, http_res
|
|
144
149
|
)
|
|
145
|
-
raise errors.RateLimitExceeded(
|
|
150
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
146
151
|
if utils.match_response(http_res, "500", "application/json"):
|
|
147
|
-
response_data = utils.
|
|
148
|
-
|
|
152
|
+
response_data = utils.unmarshal_json_response(
|
|
153
|
+
errors.InternalServerErrorData, http_res
|
|
149
154
|
)
|
|
150
|
-
raise errors.InternalServerError(
|
|
155
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
151
156
|
if utils.match_response(http_res, "4XX", "*"):
|
|
152
157
|
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
|
-
)
|
|
158
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
156
159
|
if utils.match_response(http_res, "5XX", "*"):
|
|
157
160
|
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
|
-
)
|
|
161
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
161
162
|
|
|
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
|
-
)
|
|
163
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
170
164
|
|
|
171
165
|
async def referrals_async(
|
|
172
166
|
self,
|
|
@@ -268,61 +262,55 @@ class EmbedTokens(BaseSDK):
|
|
|
268
262
|
|
|
269
263
|
response_data: Any = None
|
|
270
264
|
if utils.match_response(http_res, "201", "application/json"):
|
|
271
|
-
return utils.
|
|
272
|
-
|
|
273
|
-
Optional[operations.CreateReferralsEmbedTokenResponseBody],
|
|
265
|
+
return utils.unmarshal_json_response(
|
|
266
|
+
Optional[operations.CreateReferralsEmbedTokenResponseBody], http_res
|
|
274
267
|
)
|
|
275
268
|
if utils.match_response(http_res, "400", "application/json"):
|
|
276
|
-
response_data = utils.
|
|
277
|
-
|
|
269
|
+
response_data = utils.unmarshal_json_response(
|
|
270
|
+
errors.BadRequestData, http_res
|
|
271
|
+
)
|
|
272
|
+
raise errors.BadRequest(response_data, http_res)
|
|
278
273
|
if utils.match_response(http_res, "401", "application/json"):
|
|
279
|
-
response_data = utils.
|
|
280
|
-
|
|
274
|
+
response_data = utils.unmarshal_json_response(
|
|
275
|
+
errors.UnauthorizedData, http_res
|
|
276
|
+
)
|
|
277
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
281
278
|
if utils.match_response(http_res, "403", "application/json"):
|
|
282
|
-
response_data = utils.
|
|
283
|
-
|
|
279
|
+
response_data = utils.unmarshal_json_response(
|
|
280
|
+
errors.ForbiddenData, http_res
|
|
281
|
+
)
|
|
282
|
+
raise errors.Forbidden(response_data, http_res)
|
|
284
283
|
if utils.match_response(http_res, "404", "application/json"):
|
|
285
|
-
response_data = utils.
|
|
286
|
-
raise errors.NotFound(
|
|
284
|
+
response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
|
|
285
|
+
raise errors.NotFound(response_data, http_res)
|
|
287
286
|
if utils.match_response(http_res, "409", "application/json"):
|
|
288
|
-
response_data = utils.
|
|
289
|
-
raise errors.Conflict(
|
|
287
|
+
response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
|
|
288
|
+
raise errors.Conflict(response_data, http_res)
|
|
290
289
|
if utils.match_response(http_res, "410", "application/json"):
|
|
291
|
-
response_data = utils.
|
|
292
|
-
|
|
290
|
+
response_data = utils.unmarshal_json_response(
|
|
291
|
+
errors.InviteExpiredData, http_res
|
|
293
292
|
)
|
|
294
|
-
raise errors.InviteExpired(
|
|
293
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
295
294
|
if utils.match_response(http_res, "422", "application/json"):
|
|
296
|
-
response_data = utils.
|
|
297
|
-
|
|
295
|
+
response_data = utils.unmarshal_json_response(
|
|
296
|
+
errors.UnprocessableEntityData, http_res
|
|
298
297
|
)
|
|
299
|
-
raise errors.UnprocessableEntity(
|
|
298
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
300
299
|
if utils.match_response(http_res, "429", "application/json"):
|
|
301
|
-
response_data = utils.
|
|
302
|
-
|
|
300
|
+
response_data = utils.unmarshal_json_response(
|
|
301
|
+
errors.RateLimitExceededData, http_res
|
|
303
302
|
)
|
|
304
|
-
raise errors.RateLimitExceeded(
|
|
303
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
305
304
|
if utils.match_response(http_res, "500", "application/json"):
|
|
306
|
-
response_data = utils.
|
|
307
|
-
|
|
305
|
+
response_data = utils.unmarshal_json_response(
|
|
306
|
+
errors.InternalServerErrorData, http_res
|
|
308
307
|
)
|
|
309
|
-
raise errors.InternalServerError(
|
|
308
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
310
309
|
if utils.match_response(http_res, "4XX", "*"):
|
|
311
310
|
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
|
-
)
|
|
311
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
315
312
|
if utils.match_response(http_res, "5XX", "*"):
|
|
316
313
|
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
|
-
)
|
|
314
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
320
315
|
|
|
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
|
-
)
|
|
316
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
dub/events.py
CHANGED
|
@@ -95,63 +95,58 @@ class Events(BaseSDK):
|
|
|
95
95
|
|
|
96
96
|
response_data: Any = None
|
|
97
97
|
if utils.match_response(http_res, "200", "application/json"):
|
|
98
|
-
return utils.
|
|
99
|
-
|
|
98
|
+
return utils.unmarshal_json_response(
|
|
99
|
+
Optional[List[operations.ListEventsResponseBody]], http_res
|
|
100
100
|
)
|
|
101
101
|
if utils.match_response(http_res, "400", "application/json"):
|
|
102
|
-
response_data = utils.
|
|
103
|
-
|
|
102
|
+
response_data = utils.unmarshal_json_response(
|
|
103
|
+
errors.BadRequestData, http_res
|
|
104
|
+
)
|
|
105
|
+
raise errors.BadRequest(response_data, http_res)
|
|
104
106
|
if utils.match_response(http_res, "401", "application/json"):
|
|
105
|
-
response_data = utils.
|
|
106
|
-
|
|
107
|
+
response_data = utils.unmarshal_json_response(
|
|
108
|
+
errors.UnauthorizedData, http_res
|
|
109
|
+
)
|
|
110
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
107
111
|
if utils.match_response(http_res, "403", "application/json"):
|
|
108
|
-
response_data = utils.
|
|
109
|
-
|
|
112
|
+
response_data = utils.unmarshal_json_response(
|
|
113
|
+
errors.ForbiddenData, http_res
|
|
114
|
+
)
|
|
115
|
+
raise errors.Forbidden(response_data, http_res)
|
|
110
116
|
if utils.match_response(http_res, "404", "application/json"):
|
|
111
|
-
response_data = utils.
|
|
112
|
-
raise errors.NotFound(
|
|
117
|
+
response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
|
|
118
|
+
raise errors.NotFound(response_data, http_res)
|
|
113
119
|
if utils.match_response(http_res, "409", "application/json"):
|
|
114
|
-
response_data = utils.
|
|
115
|
-
raise errors.Conflict(
|
|
120
|
+
response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
|
|
121
|
+
raise errors.Conflict(response_data, http_res)
|
|
116
122
|
if utils.match_response(http_res, "410", "application/json"):
|
|
117
|
-
response_data = utils.
|
|
118
|
-
|
|
123
|
+
response_data = utils.unmarshal_json_response(
|
|
124
|
+
errors.InviteExpiredData, http_res
|
|
119
125
|
)
|
|
120
|
-
raise errors.InviteExpired(
|
|
126
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
121
127
|
if utils.match_response(http_res, "422", "application/json"):
|
|
122
|
-
response_data = utils.
|
|
123
|
-
|
|
128
|
+
response_data = utils.unmarshal_json_response(
|
|
129
|
+
errors.UnprocessableEntityData, http_res
|
|
124
130
|
)
|
|
125
|
-
raise errors.UnprocessableEntity(
|
|
131
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
126
132
|
if utils.match_response(http_res, "429", "application/json"):
|
|
127
|
-
response_data = utils.
|
|
128
|
-
|
|
133
|
+
response_data = utils.unmarshal_json_response(
|
|
134
|
+
errors.RateLimitExceededData, http_res
|
|
129
135
|
)
|
|
130
|
-
raise errors.RateLimitExceeded(
|
|
136
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
131
137
|
if utils.match_response(http_res, "500", "application/json"):
|
|
132
|
-
response_data = utils.
|
|
133
|
-
|
|
138
|
+
response_data = utils.unmarshal_json_response(
|
|
139
|
+
errors.InternalServerErrorData, http_res
|
|
134
140
|
)
|
|
135
|
-
raise errors.InternalServerError(
|
|
141
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
136
142
|
if utils.match_response(http_res, "4XX", "*"):
|
|
137
143
|
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
|
-
)
|
|
144
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
141
145
|
if utils.match_response(http_res, "5XX", "*"):
|
|
142
146
|
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
|
-
)
|
|
147
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
146
148
|
|
|
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
|
-
)
|
|
149
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
155
150
|
|
|
156
151
|
async def list_async(
|
|
157
152
|
self,
|
|
@@ -239,60 +234,55 @@ class Events(BaseSDK):
|
|
|
239
234
|
|
|
240
235
|
response_data: Any = None
|
|
241
236
|
if utils.match_response(http_res, "200", "application/json"):
|
|
242
|
-
return utils.
|
|
243
|
-
|
|
237
|
+
return utils.unmarshal_json_response(
|
|
238
|
+
Optional[List[operations.ListEventsResponseBody]], http_res
|
|
244
239
|
)
|
|
245
240
|
if utils.match_response(http_res, "400", "application/json"):
|
|
246
|
-
response_data = utils.
|
|
247
|
-
|
|
241
|
+
response_data = utils.unmarshal_json_response(
|
|
242
|
+
errors.BadRequestData, http_res
|
|
243
|
+
)
|
|
244
|
+
raise errors.BadRequest(response_data, http_res)
|
|
248
245
|
if utils.match_response(http_res, "401", "application/json"):
|
|
249
|
-
response_data = utils.
|
|
250
|
-
|
|
246
|
+
response_data = utils.unmarshal_json_response(
|
|
247
|
+
errors.UnauthorizedData, http_res
|
|
248
|
+
)
|
|
249
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
251
250
|
if utils.match_response(http_res, "403", "application/json"):
|
|
252
|
-
response_data = utils.
|
|
253
|
-
|
|
251
|
+
response_data = utils.unmarshal_json_response(
|
|
252
|
+
errors.ForbiddenData, http_res
|
|
253
|
+
)
|
|
254
|
+
raise errors.Forbidden(response_data, http_res)
|
|
254
255
|
if utils.match_response(http_res, "404", "application/json"):
|
|
255
|
-
response_data = utils.
|
|
256
|
-
raise errors.NotFound(
|
|
256
|
+
response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
|
|
257
|
+
raise errors.NotFound(response_data, http_res)
|
|
257
258
|
if utils.match_response(http_res, "409", "application/json"):
|
|
258
|
-
response_data = utils.
|
|
259
|
-
raise errors.Conflict(
|
|
259
|
+
response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
|
|
260
|
+
raise errors.Conflict(response_data, http_res)
|
|
260
261
|
if utils.match_response(http_res, "410", "application/json"):
|
|
261
|
-
response_data = utils.
|
|
262
|
-
|
|
262
|
+
response_data = utils.unmarshal_json_response(
|
|
263
|
+
errors.InviteExpiredData, http_res
|
|
263
264
|
)
|
|
264
|
-
raise errors.InviteExpired(
|
|
265
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
265
266
|
if utils.match_response(http_res, "422", "application/json"):
|
|
266
|
-
response_data = utils.
|
|
267
|
-
|
|
267
|
+
response_data = utils.unmarshal_json_response(
|
|
268
|
+
errors.UnprocessableEntityData, http_res
|
|
268
269
|
)
|
|
269
|
-
raise errors.UnprocessableEntity(
|
|
270
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
270
271
|
if utils.match_response(http_res, "429", "application/json"):
|
|
271
|
-
response_data = utils.
|
|
272
|
-
|
|
272
|
+
response_data = utils.unmarshal_json_response(
|
|
273
|
+
errors.RateLimitExceededData, http_res
|
|
273
274
|
)
|
|
274
|
-
raise errors.RateLimitExceeded(
|
|
275
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
275
276
|
if utils.match_response(http_res, "500", "application/json"):
|
|
276
|
-
response_data = utils.
|
|
277
|
-
|
|
277
|
+
response_data = utils.unmarshal_json_response(
|
|
278
|
+
errors.InternalServerErrorData, http_res
|
|
278
279
|
)
|
|
279
|
-
raise errors.InternalServerError(
|
|
280
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
280
281
|
if utils.match_response(http_res, "4XX", "*"):
|
|
281
282
|
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
|
-
)
|
|
283
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
285
284
|
if utils.match_response(http_res, "5XX", "*"):
|
|
286
285
|
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
|
-
)
|
|
286
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
290
287
|
|
|
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
|
-
)
|
|
288
|
+
raise errors.SDKError("Unexpected response received", http_res)
|