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 CHANGED
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "dub"
6
- __version__: str = "0.26.12"
6
+ __version__: str = "0.27.0"
7
7
  __openapi_doc_version__: str = "0.0.1"
8
- __gen_version__: str = "2.644.1"
9
- __user_agent__: str = "speakeasy-sdk/python 0.26.12 2.644.1 0.0.1 dub"
8
+ __gen_version__: str = "2.651.2"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.27.0 2.651.2 0.0.1 dub"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
dub/analytics.py CHANGED
@@ -96,63 +96,58 @@ class Analytics(BaseSDK):
96
96
 
97
97
  response_data: Any = None
98
98
  if utils.match_response(http_res, "200", "application/json"):
99
- return utils.unmarshal_json(
100
- http_res.text, Optional[operations.RetrieveAnalyticsResponseBody]
99
+ return utils.unmarshal_json_response(
100
+ Optional[operations.RetrieveAnalyticsResponseBody], http_res
101
101
  )
102
102
  if utils.match_response(http_res, "400", "application/json"):
103
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
104
- raise errors.BadRequest(data=response_data)
103
+ response_data = utils.unmarshal_json_response(
104
+ errors.BadRequestData, http_res
105
+ )
106
+ raise errors.BadRequest(response_data, http_res)
105
107
  if utils.match_response(http_res, "401", "application/json"):
106
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
107
- raise errors.Unauthorized(data=response_data)
108
+ response_data = utils.unmarshal_json_response(
109
+ errors.UnauthorizedData, http_res
110
+ )
111
+ raise errors.Unauthorized(response_data, http_res)
108
112
  if utils.match_response(http_res, "403", "application/json"):
109
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
110
- raise errors.Forbidden(data=response_data)
113
+ response_data = utils.unmarshal_json_response(
114
+ errors.ForbiddenData, http_res
115
+ )
116
+ raise errors.Forbidden(response_data, http_res)
111
117
  if utils.match_response(http_res, "404", "application/json"):
112
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
113
- raise errors.NotFound(data=response_data)
118
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
119
+ raise errors.NotFound(response_data, http_res)
114
120
  if utils.match_response(http_res, "409", "application/json"):
115
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
116
- raise errors.Conflict(data=response_data)
121
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
122
+ raise errors.Conflict(response_data, http_res)
117
123
  if utils.match_response(http_res, "410", "application/json"):
118
- response_data = utils.unmarshal_json(
119
- http_res.text, errors.InviteExpiredData
124
+ response_data = utils.unmarshal_json_response(
125
+ errors.InviteExpiredData, http_res
120
126
  )
121
- raise errors.InviteExpired(data=response_data)
127
+ raise errors.InviteExpired(response_data, http_res)
122
128
  if utils.match_response(http_res, "422", "application/json"):
123
- response_data = utils.unmarshal_json(
124
- http_res.text, errors.UnprocessableEntityData
129
+ response_data = utils.unmarshal_json_response(
130
+ errors.UnprocessableEntityData, http_res
125
131
  )
126
- raise errors.UnprocessableEntity(data=response_data)
132
+ raise errors.UnprocessableEntity(response_data, http_res)
127
133
  if utils.match_response(http_res, "429", "application/json"):
128
- response_data = utils.unmarshal_json(
129
- http_res.text, errors.RateLimitExceededData
134
+ response_data = utils.unmarshal_json_response(
135
+ errors.RateLimitExceededData, http_res
130
136
  )
131
- raise errors.RateLimitExceeded(data=response_data)
137
+ raise errors.RateLimitExceeded(response_data, http_res)
132
138
  if utils.match_response(http_res, "500", "application/json"):
133
- response_data = utils.unmarshal_json(
134
- http_res.text, errors.InternalServerErrorData
139
+ response_data = utils.unmarshal_json_response(
140
+ errors.InternalServerErrorData, http_res
135
141
  )
136
- raise errors.InternalServerError(data=response_data)
142
+ raise errors.InternalServerError(response_data, http_res)
137
143
  if utils.match_response(http_res, "4XX", "*"):
138
144
  http_res_text = utils.stream_to_text(http_res)
139
- raise errors.SDKError(
140
- "API error occurred", http_res.status_code, http_res_text, http_res
141
- )
145
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
142
146
  if utils.match_response(http_res, "5XX", "*"):
143
147
  http_res_text = utils.stream_to_text(http_res)
144
- raise errors.SDKError(
145
- "API error occurred", http_res.status_code, http_res_text, http_res
146
- )
148
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
147
149
 
148
- content_type = http_res.headers.get("Content-Type")
149
- http_res_text = utils.stream_to_text(http_res)
150
- raise errors.SDKError(
151
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
152
- http_res.status_code,
153
- http_res_text,
154
- http_res,
155
- )
150
+ raise errors.SDKError("Unexpected response received", http_res)
156
151
 
157
152
  async def retrieve_async(
158
153
  self,
@@ -241,60 +236,55 @@ class Analytics(BaseSDK):
241
236
 
242
237
  response_data: Any = None
243
238
  if utils.match_response(http_res, "200", "application/json"):
244
- return utils.unmarshal_json(
245
- http_res.text, Optional[operations.RetrieveAnalyticsResponseBody]
239
+ return utils.unmarshal_json_response(
240
+ Optional[operations.RetrieveAnalyticsResponseBody], http_res
246
241
  )
247
242
  if utils.match_response(http_res, "400", "application/json"):
248
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
249
- raise errors.BadRequest(data=response_data)
243
+ response_data = utils.unmarshal_json_response(
244
+ errors.BadRequestData, http_res
245
+ )
246
+ raise errors.BadRequest(response_data, http_res)
250
247
  if utils.match_response(http_res, "401", "application/json"):
251
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
252
- raise errors.Unauthorized(data=response_data)
248
+ response_data = utils.unmarshal_json_response(
249
+ errors.UnauthorizedData, http_res
250
+ )
251
+ raise errors.Unauthorized(response_data, http_res)
253
252
  if utils.match_response(http_res, "403", "application/json"):
254
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
255
- raise errors.Forbidden(data=response_data)
253
+ response_data = utils.unmarshal_json_response(
254
+ errors.ForbiddenData, http_res
255
+ )
256
+ raise errors.Forbidden(response_data, http_res)
256
257
  if utils.match_response(http_res, "404", "application/json"):
257
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
258
- raise errors.NotFound(data=response_data)
258
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
259
+ raise errors.NotFound(response_data, http_res)
259
260
  if utils.match_response(http_res, "409", "application/json"):
260
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
261
- raise errors.Conflict(data=response_data)
261
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
262
+ raise errors.Conflict(response_data, http_res)
262
263
  if utils.match_response(http_res, "410", "application/json"):
263
- response_data = utils.unmarshal_json(
264
- http_res.text, errors.InviteExpiredData
264
+ response_data = utils.unmarshal_json_response(
265
+ errors.InviteExpiredData, http_res
265
266
  )
266
- raise errors.InviteExpired(data=response_data)
267
+ raise errors.InviteExpired(response_data, http_res)
267
268
  if utils.match_response(http_res, "422", "application/json"):
268
- response_data = utils.unmarshal_json(
269
- http_res.text, errors.UnprocessableEntityData
269
+ response_data = utils.unmarshal_json_response(
270
+ errors.UnprocessableEntityData, http_res
270
271
  )
271
- raise errors.UnprocessableEntity(data=response_data)
272
+ raise errors.UnprocessableEntity(response_data, http_res)
272
273
  if utils.match_response(http_res, "429", "application/json"):
273
- response_data = utils.unmarshal_json(
274
- http_res.text, errors.RateLimitExceededData
274
+ response_data = utils.unmarshal_json_response(
275
+ errors.RateLimitExceededData, http_res
275
276
  )
276
- raise errors.RateLimitExceeded(data=response_data)
277
+ raise errors.RateLimitExceeded(response_data, http_res)
277
278
  if utils.match_response(http_res, "500", "application/json"):
278
- response_data = utils.unmarshal_json(
279
- http_res.text, errors.InternalServerErrorData
279
+ response_data = utils.unmarshal_json_response(
280
+ errors.InternalServerErrorData, http_res
280
281
  )
281
- raise errors.InternalServerError(data=response_data)
282
+ raise errors.InternalServerError(response_data, http_res)
282
283
  if utils.match_response(http_res, "4XX", "*"):
283
284
  http_res_text = await utils.stream_to_text_async(http_res)
284
- raise errors.SDKError(
285
- "API error occurred", http_res.status_code, http_res_text, http_res
286
- )
285
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
287
286
  if utils.match_response(http_res, "5XX", "*"):
288
287
  http_res_text = await utils.stream_to_text_async(http_res)
289
- raise errors.SDKError(
290
- "API error occurred", http_res.status_code, http_res_text, http_res
291
- )
288
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
292
289
 
293
- content_type = http_res.headers.get("Content-Type")
294
- http_res_text = await utils.stream_to_text_async(http_res)
295
- raise errors.SDKError(
296
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
297
- http_res.status_code,
298
- http_res_text,
299
- http_res,
300
- )
290
+ raise errors.SDKError("Unexpected response received", http_res)
dub/basesdk.py CHANGED
@@ -241,7 +241,7 @@ class BaseSDK:
241
241
 
242
242
  if http_res is None:
243
243
  logger.debug("Raising no response SDK error")
244
- raise errors.SDKError("No response received")
244
+ raise errors.NoResponseError("No response received")
245
245
 
246
246
  logger.debug(
247
247
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -262,7 +262,7 @@ class BaseSDK:
262
262
  http_res = result
263
263
  else:
264
264
  logger.debug("Raising unexpected SDK error")
265
- raise errors.SDKError("Unexpected error occurred")
265
+ raise errors.SDKError("Unexpected error occurred", http_res)
266
266
 
267
267
  return http_res
268
268
 
@@ -313,7 +313,7 @@ class BaseSDK:
313
313
 
314
314
  if http_res is None:
315
315
  logger.debug("Raising no response SDK error")
316
- raise errors.SDKError("No response received")
316
+ raise errors.NoResponseError("No response received")
317
317
 
318
318
  logger.debug(
319
319
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -334,7 +334,7 @@ class BaseSDK:
334
334
  http_res = result
335
335
  else:
336
336
  logger.debug("Raising unexpected SDK error")
337
- raise errors.SDKError("Unexpected error occurred")
337
+ raise errors.SDKError("Unexpected error occurred", http_res)
338
338
 
339
339
  return http_res
340
340
 
dub/commissions.py CHANGED
@@ -96,63 +96,58 @@ class Commissions(BaseSDK):
96
96
 
97
97
  response_data: Any = None
98
98
  if utils.match_response(http_res, "200", "application/json"):
99
- return utils.unmarshal_json(
100
- http_res.text, Optional[List[operations.ListCommissionsResponseBody]]
99
+ return utils.unmarshal_json_response(
100
+ Optional[List[operations.ListCommissionsResponseBody]], http_res
101
101
  )
102
102
  if utils.match_response(http_res, "400", "application/json"):
103
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
104
- raise errors.BadRequest(data=response_data)
103
+ response_data = utils.unmarshal_json_response(
104
+ errors.BadRequestData, http_res
105
+ )
106
+ raise errors.BadRequest(response_data, http_res)
105
107
  if utils.match_response(http_res, "401", "application/json"):
106
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
107
- raise errors.Unauthorized(data=response_data)
108
+ response_data = utils.unmarshal_json_response(
109
+ errors.UnauthorizedData, http_res
110
+ )
111
+ raise errors.Unauthorized(response_data, http_res)
108
112
  if utils.match_response(http_res, "403", "application/json"):
109
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
110
- raise errors.Forbidden(data=response_data)
113
+ response_data = utils.unmarshal_json_response(
114
+ errors.ForbiddenData, http_res
115
+ )
116
+ raise errors.Forbidden(response_data, http_res)
111
117
  if utils.match_response(http_res, "404", "application/json"):
112
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
113
- raise errors.NotFound(data=response_data)
118
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
119
+ raise errors.NotFound(response_data, http_res)
114
120
  if utils.match_response(http_res, "409", "application/json"):
115
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
116
- raise errors.Conflict(data=response_data)
121
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
122
+ raise errors.Conflict(response_data, http_res)
117
123
  if utils.match_response(http_res, "410", "application/json"):
118
- response_data = utils.unmarshal_json(
119
- http_res.text, errors.InviteExpiredData
124
+ response_data = utils.unmarshal_json_response(
125
+ errors.InviteExpiredData, http_res
120
126
  )
121
- raise errors.InviteExpired(data=response_data)
127
+ raise errors.InviteExpired(response_data, http_res)
122
128
  if utils.match_response(http_res, "422", "application/json"):
123
- response_data = utils.unmarshal_json(
124
- http_res.text, errors.UnprocessableEntityData
129
+ response_data = utils.unmarshal_json_response(
130
+ errors.UnprocessableEntityData, http_res
125
131
  )
126
- raise errors.UnprocessableEntity(data=response_data)
132
+ raise errors.UnprocessableEntity(response_data, http_res)
127
133
  if utils.match_response(http_res, "429", "application/json"):
128
- response_data = utils.unmarshal_json(
129
- http_res.text, errors.RateLimitExceededData
134
+ response_data = utils.unmarshal_json_response(
135
+ errors.RateLimitExceededData, http_res
130
136
  )
131
- raise errors.RateLimitExceeded(data=response_data)
137
+ raise errors.RateLimitExceeded(response_data, http_res)
132
138
  if utils.match_response(http_res, "500", "application/json"):
133
- response_data = utils.unmarshal_json(
134
- http_res.text, errors.InternalServerErrorData
139
+ response_data = utils.unmarshal_json_response(
140
+ errors.InternalServerErrorData, http_res
135
141
  )
136
- raise errors.InternalServerError(data=response_data)
142
+ raise errors.InternalServerError(response_data, http_res)
137
143
  if utils.match_response(http_res, "4XX", "*"):
138
144
  http_res_text = utils.stream_to_text(http_res)
139
- raise errors.SDKError(
140
- "API error occurred", http_res.status_code, http_res_text, http_res
141
- )
145
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
142
146
  if utils.match_response(http_res, "5XX", "*"):
143
147
  http_res_text = utils.stream_to_text(http_res)
144
- raise errors.SDKError(
145
- "API error occurred", http_res.status_code, http_res_text, http_res
146
- )
148
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
147
149
 
148
- content_type = http_res.headers.get("Content-Type")
149
- http_res_text = utils.stream_to_text(http_res)
150
- raise errors.SDKError(
151
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
152
- http_res.status_code,
153
- http_res_text,
154
- http_res,
155
- )
150
+ raise errors.SDKError("Unexpected response received", http_res)
156
151
 
157
152
  async def list_async(
158
153
  self,
@@ -241,63 +236,58 @@ class Commissions(BaseSDK):
241
236
 
242
237
  response_data: Any = None
243
238
  if utils.match_response(http_res, "200", "application/json"):
244
- return utils.unmarshal_json(
245
- http_res.text, Optional[List[operations.ListCommissionsResponseBody]]
239
+ return utils.unmarshal_json_response(
240
+ Optional[List[operations.ListCommissionsResponseBody]], http_res
246
241
  )
247
242
  if utils.match_response(http_res, "400", "application/json"):
248
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
249
- raise errors.BadRequest(data=response_data)
243
+ response_data = utils.unmarshal_json_response(
244
+ errors.BadRequestData, http_res
245
+ )
246
+ raise errors.BadRequest(response_data, http_res)
250
247
  if utils.match_response(http_res, "401", "application/json"):
251
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
252
- raise errors.Unauthorized(data=response_data)
248
+ response_data = utils.unmarshal_json_response(
249
+ errors.UnauthorizedData, http_res
250
+ )
251
+ raise errors.Unauthorized(response_data, http_res)
253
252
  if utils.match_response(http_res, "403", "application/json"):
254
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
255
- raise errors.Forbidden(data=response_data)
253
+ response_data = utils.unmarshal_json_response(
254
+ errors.ForbiddenData, http_res
255
+ )
256
+ raise errors.Forbidden(response_data, http_res)
256
257
  if utils.match_response(http_res, "404", "application/json"):
257
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
258
- raise errors.NotFound(data=response_data)
258
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
259
+ raise errors.NotFound(response_data, http_res)
259
260
  if utils.match_response(http_res, "409", "application/json"):
260
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
261
- raise errors.Conflict(data=response_data)
261
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
262
+ raise errors.Conflict(response_data, http_res)
262
263
  if utils.match_response(http_res, "410", "application/json"):
263
- response_data = utils.unmarshal_json(
264
- http_res.text, errors.InviteExpiredData
264
+ response_data = utils.unmarshal_json_response(
265
+ errors.InviteExpiredData, http_res
265
266
  )
266
- raise errors.InviteExpired(data=response_data)
267
+ raise errors.InviteExpired(response_data, http_res)
267
268
  if utils.match_response(http_res, "422", "application/json"):
268
- response_data = utils.unmarshal_json(
269
- http_res.text, errors.UnprocessableEntityData
269
+ response_data = utils.unmarshal_json_response(
270
+ errors.UnprocessableEntityData, http_res
270
271
  )
271
- raise errors.UnprocessableEntity(data=response_data)
272
+ raise errors.UnprocessableEntity(response_data, http_res)
272
273
  if utils.match_response(http_res, "429", "application/json"):
273
- response_data = utils.unmarshal_json(
274
- http_res.text, errors.RateLimitExceededData
274
+ response_data = utils.unmarshal_json_response(
275
+ errors.RateLimitExceededData, http_res
275
276
  )
276
- raise errors.RateLimitExceeded(data=response_data)
277
+ raise errors.RateLimitExceeded(response_data, http_res)
277
278
  if utils.match_response(http_res, "500", "application/json"):
278
- response_data = utils.unmarshal_json(
279
- http_res.text, errors.InternalServerErrorData
279
+ response_data = utils.unmarshal_json_response(
280
+ errors.InternalServerErrorData, http_res
280
281
  )
281
- raise errors.InternalServerError(data=response_data)
282
+ raise errors.InternalServerError(response_data, http_res)
282
283
  if utils.match_response(http_res, "4XX", "*"):
283
284
  http_res_text = await utils.stream_to_text_async(http_res)
284
- raise errors.SDKError(
285
- "API error occurred", http_res.status_code, http_res_text, http_res
286
- )
285
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
287
286
  if utils.match_response(http_res, "5XX", "*"):
288
287
  http_res_text = await utils.stream_to_text_async(http_res)
289
- raise errors.SDKError(
290
- "API error occurred", http_res.status_code, http_res_text, http_res
291
- )
288
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
292
289
 
293
- content_type = http_res.headers.get("Content-Type")
294
- http_res_text = await utils.stream_to_text_async(http_res)
295
- raise errors.SDKError(
296
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
297
- http_res.status_code,
298
- http_res_text,
299
- http_res,
300
- )
290
+ raise errors.SDKError("Unexpected response received", http_res)
301
291
 
302
292
  def update(
303
293
  self,
@@ -393,63 +383,58 @@ class Commissions(BaseSDK):
393
383
 
394
384
  response_data: Any = None
395
385
  if utils.match_response(http_res, "200", "application/json"):
396
- return utils.unmarshal_json(
397
- http_res.text, Optional[operations.UpdateCommissionResponseBody]
386
+ return utils.unmarshal_json_response(
387
+ Optional[operations.UpdateCommissionResponseBody], http_res
398
388
  )
399
389
  if utils.match_response(http_res, "400", "application/json"):
400
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
401
- raise errors.BadRequest(data=response_data)
390
+ response_data = utils.unmarshal_json_response(
391
+ errors.BadRequestData, http_res
392
+ )
393
+ raise errors.BadRequest(response_data, http_res)
402
394
  if utils.match_response(http_res, "401", "application/json"):
403
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
404
- raise errors.Unauthorized(data=response_data)
395
+ response_data = utils.unmarshal_json_response(
396
+ errors.UnauthorizedData, http_res
397
+ )
398
+ raise errors.Unauthorized(response_data, http_res)
405
399
  if utils.match_response(http_res, "403", "application/json"):
406
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
407
- raise errors.Forbidden(data=response_data)
400
+ response_data = utils.unmarshal_json_response(
401
+ errors.ForbiddenData, http_res
402
+ )
403
+ raise errors.Forbidden(response_data, http_res)
408
404
  if utils.match_response(http_res, "404", "application/json"):
409
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
410
- raise errors.NotFound(data=response_data)
405
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
406
+ raise errors.NotFound(response_data, http_res)
411
407
  if utils.match_response(http_res, "409", "application/json"):
412
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
413
- raise errors.Conflict(data=response_data)
408
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
409
+ raise errors.Conflict(response_data, http_res)
414
410
  if utils.match_response(http_res, "410", "application/json"):
415
- response_data = utils.unmarshal_json(
416
- http_res.text, errors.InviteExpiredData
411
+ response_data = utils.unmarshal_json_response(
412
+ errors.InviteExpiredData, http_res
417
413
  )
418
- raise errors.InviteExpired(data=response_data)
414
+ raise errors.InviteExpired(response_data, http_res)
419
415
  if utils.match_response(http_res, "422", "application/json"):
420
- response_data = utils.unmarshal_json(
421
- http_res.text, errors.UnprocessableEntityData
416
+ response_data = utils.unmarshal_json_response(
417
+ errors.UnprocessableEntityData, http_res
422
418
  )
423
- raise errors.UnprocessableEntity(data=response_data)
419
+ raise errors.UnprocessableEntity(response_data, http_res)
424
420
  if utils.match_response(http_res, "429", "application/json"):
425
- response_data = utils.unmarshal_json(
426
- http_res.text, errors.RateLimitExceededData
421
+ response_data = utils.unmarshal_json_response(
422
+ errors.RateLimitExceededData, http_res
427
423
  )
428
- raise errors.RateLimitExceeded(data=response_data)
424
+ raise errors.RateLimitExceeded(response_data, http_res)
429
425
  if utils.match_response(http_res, "500", "application/json"):
430
- response_data = utils.unmarshal_json(
431
- http_res.text, errors.InternalServerErrorData
426
+ response_data = utils.unmarshal_json_response(
427
+ errors.InternalServerErrorData, http_res
432
428
  )
433
- raise errors.InternalServerError(data=response_data)
429
+ raise errors.InternalServerError(response_data, http_res)
434
430
  if utils.match_response(http_res, "4XX", "*"):
435
431
  http_res_text = utils.stream_to_text(http_res)
436
- raise errors.SDKError(
437
- "API error occurred", http_res.status_code, http_res_text, http_res
438
- )
432
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
439
433
  if utils.match_response(http_res, "5XX", "*"):
440
434
  http_res_text = utils.stream_to_text(http_res)
441
- raise errors.SDKError(
442
- "API error occurred", http_res.status_code, http_res_text, http_res
443
- )
435
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
444
436
 
445
- content_type = http_res.headers.get("Content-Type")
446
- http_res_text = utils.stream_to_text(http_res)
447
- raise errors.SDKError(
448
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
449
- http_res.status_code,
450
- http_res_text,
451
- http_res,
452
- )
437
+ raise errors.SDKError("Unexpected response received", http_res)
453
438
 
454
439
  async def update_async(
455
440
  self,
@@ -545,60 +530,55 @@ class Commissions(BaseSDK):
545
530
 
546
531
  response_data: Any = None
547
532
  if utils.match_response(http_res, "200", "application/json"):
548
- return utils.unmarshal_json(
549
- http_res.text, Optional[operations.UpdateCommissionResponseBody]
533
+ return utils.unmarshal_json_response(
534
+ Optional[operations.UpdateCommissionResponseBody], http_res
550
535
  )
551
536
  if utils.match_response(http_res, "400", "application/json"):
552
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
553
- raise errors.BadRequest(data=response_data)
537
+ response_data = utils.unmarshal_json_response(
538
+ errors.BadRequestData, http_res
539
+ )
540
+ raise errors.BadRequest(response_data, http_res)
554
541
  if utils.match_response(http_res, "401", "application/json"):
555
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
556
- raise errors.Unauthorized(data=response_data)
542
+ response_data = utils.unmarshal_json_response(
543
+ errors.UnauthorizedData, http_res
544
+ )
545
+ raise errors.Unauthorized(response_data, http_res)
557
546
  if utils.match_response(http_res, "403", "application/json"):
558
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
559
- raise errors.Forbidden(data=response_data)
547
+ response_data = utils.unmarshal_json_response(
548
+ errors.ForbiddenData, http_res
549
+ )
550
+ raise errors.Forbidden(response_data, http_res)
560
551
  if utils.match_response(http_res, "404", "application/json"):
561
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
562
- raise errors.NotFound(data=response_data)
552
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
553
+ raise errors.NotFound(response_data, http_res)
563
554
  if utils.match_response(http_res, "409", "application/json"):
564
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
565
- raise errors.Conflict(data=response_data)
555
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
556
+ raise errors.Conflict(response_data, http_res)
566
557
  if utils.match_response(http_res, "410", "application/json"):
567
- response_data = utils.unmarshal_json(
568
- http_res.text, errors.InviteExpiredData
558
+ response_data = utils.unmarshal_json_response(
559
+ errors.InviteExpiredData, http_res
569
560
  )
570
- raise errors.InviteExpired(data=response_data)
561
+ raise errors.InviteExpired(response_data, http_res)
571
562
  if utils.match_response(http_res, "422", "application/json"):
572
- response_data = utils.unmarshal_json(
573
- http_res.text, errors.UnprocessableEntityData
563
+ response_data = utils.unmarshal_json_response(
564
+ errors.UnprocessableEntityData, http_res
574
565
  )
575
- raise errors.UnprocessableEntity(data=response_data)
566
+ raise errors.UnprocessableEntity(response_data, http_res)
576
567
  if utils.match_response(http_res, "429", "application/json"):
577
- response_data = utils.unmarshal_json(
578
- http_res.text, errors.RateLimitExceededData
568
+ response_data = utils.unmarshal_json_response(
569
+ errors.RateLimitExceededData, http_res
579
570
  )
580
- raise errors.RateLimitExceeded(data=response_data)
571
+ raise errors.RateLimitExceeded(response_data, http_res)
581
572
  if utils.match_response(http_res, "500", "application/json"):
582
- response_data = utils.unmarshal_json(
583
- http_res.text, errors.InternalServerErrorData
573
+ response_data = utils.unmarshal_json_response(
574
+ errors.InternalServerErrorData, http_res
584
575
  )
585
- raise errors.InternalServerError(data=response_data)
576
+ raise errors.InternalServerError(response_data, http_res)
586
577
  if utils.match_response(http_res, "4XX", "*"):
587
578
  http_res_text = await utils.stream_to_text_async(http_res)
588
- raise errors.SDKError(
589
- "API error occurred", http_res.status_code, http_res_text, http_res
590
- )
579
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
591
580
  if utils.match_response(http_res, "5XX", "*"):
592
581
  http_res_text = await utils.stream_to_text_async(http_res)
593
- raise errors.SDKError(
594
- "API error occurred", http_res.status_code, http_res_text, http_res
595
- )
582
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
596
583
 
597
- content_type = http_res.headers.get("Content-Type")
598
- http_res_text = await utils.stream_to_text_async(http_res)
599
- raise errors.SDKError(
600
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
601
- http_res.status_code,
602
- http_res_text,
603
- http_res,
604
- )
584
+ raise errors.SDKError("Unexpected response received", http_res)