lambdadb 0.3.5__py3-none-any.whl → 0.3.6__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.
Potentially problematic release.
This version of lambdadb might be problematic. Click here for more details.
- lambdadb/_version.py +3 -3
- lambdadb/basesdk.py +4 -4
- lambdadb/collections.py +234 -350
- lambdadb/docs.py +239 -367
- lambdadb/errors/__init__.py +9 -0
- lambdadb/errors/apierror.py +30 -14
- lambdadb/errors/badrequest_error.py +12 -6
- lambdadb/errors/internalservererror.py +12 -6
- lambdadb/errors/lambdadberror.py +26 -0
- lambdadb/errors/no_response_error.py +13 -0
- lambdadb/errors/resourcealreadyexists_error.py +12 -6
- lambdadb/errors/resourcenotfound_error.py +12 -6
- lambdadb/errors/responsevalidationerror.py +25 -0
- lambdadb/errors/toomanyrequests_error.py +12 -6
- lambdadb/errors/unauthenticated_error.py +12 -6
- lambdadb/models/__init__.py +0 -42
- lambdadb/models/deletedocsop.py +3 -11
- lambdadb/models/fetchdocsop.py +3 -11
- lambdadb/models/querycollectionop.py +7 -31
- lambdadb/models/updatedocsop.py +3 -11
- lambdadb/models/upsertdocsop.py +3 -11
- lambdadb/utils/__init__.py +3 -0
- lambdadb/utils/serializers.py +21 -3
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/METADATA +49 -36
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/RECORD +27 -24
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/LICENSE +0 -0
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/WHEEL +0 -0
lambdadb/docs.py
CHANGED
|
@@ -5,7 +5,7 @@ from lambdadb import errors, models, utils
|
|
|
5
5
|
from lambdadb._hooks import HookContext
|
|
6
6
|
from lambdadb.types import OptionalNullable, UNSET
|
|
7
7
|
from lambdadb.utils import get_security_from_env
|
|
8
|
-
from typing import Any, List, Mapping, Optional
|
|
8
|
+
from typing import Any, Dict, List, Mapping, Optional
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Docs(BaseSDK):
|
|
@@ -14,7 +14,7 @@ class Docs(BaseSDK):
|
|
|
14
14
|
*,
|
|
15
15
|
project_name: str,
|
|
16
16
|
collection_name: str,
|
|
17
|
-
docs:
|
|
17
|
+
docs: List[Dict[str, Any]],
|
|
18
18
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
19
|
server_url: Optional[str] = None,
|
|
20
20
|
timeout_ms: Optional[int] = None,
|
|
@@ -44,7 +44,7 @@ class Docs(BaseSDK):
|
|
|
44
44
|
project_name=project_name,
|
|
45
45
|
collection_name=collection_name,
|
|
46
46
|
request_body=models.UpsertDocsRequestBody(
|
|
47
|
-
docs=
|
|
47
|
+
docs=docs,
|
|
48
48
|
),
|
|
49
49
|
)
|
|
50
50
|
|
|
@@ -96,58 +96,47 @@ class Docs(BaseSDK):
|
|
|
96
96
|
|
|
97
97
|
response_data: Any = None
|
|
98
98
|
if utils.match_response(http_res, "202", "application/json"):
|
|
99
|
-
return utils.
|
|
99
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
100
100
|
if utils.match_response(http_res, "400", "application/json"):
|
|
101
|
-
response_data = utils.
|
|
102
|
-
|
|
101
|
+
response_data = utils.unmarshal_json_response(
|
|
102
|
+
errors.BadRequestErrorData, http_res
|
|
103
103
|
)
|
|
104
|
-
raise errors.BadRequestError(
|
|
104
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
105
105
|
if utils.match_response(http_res, "401", "application/json"):
|
|
106
|
-
response_data = utils.
|
|
107
|
-
|
|
106
|
+
response_data = utils.unmarshal_json_response(
|
|
107
|
+
errors.UnauthenticatedErrorData, http_res
|
|
108
108
|
)
|
|
109
|
-
raise errors.UnauthenticatedError(
|
|
109
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
110
110
|
if utils.match_response(http_res, "404", "application/json"):
|
|
111
|
-
response_data = utils.
|
|
112
|
-
|
|
111
|
+
response_data = utils.unmarshal_json_response(
|
|
112
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
113
113
|
)
|
|
114
|
-
raise errors.ResourceNotFoundError(
|
|
114
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
115
115
|
if utils.match_response(http_res, "429", "application/json"):
|
|
116
|
-
response_data = utils.
|
|
117
|
-
|
|
116
|
+
response_data = utils.unmarshal_json_response(
|
|
117
|
+
errors.TooManyRequestsErrorData, http_res
|
|
118
118
|
)
|
|
119
|
-
raise errors.TooManyRequestsError(
|
|
119
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
120
120
|
if utils.match_response(http_res, "500", "application/json"):
|
|
121
|
-
response_data = utils.
|
|
122
|
-
|
|
121
|
+
response_data = utils.unmarshal_json_response(
|
|
122
|
+
errors.InternalServerErrorData, http_res
|
|
123
123
|
)
|
|
124
|
-
raise errors.InternalServerError(
|
|
124
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
125
125
|
if utils.match_response(http_res, "4XX", "*"):
|
|
126
126
|
http_res_text = utils.stream_to_text(http_res)
|
|
127
|
-
raise errors.APIError(
|
|
128
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
129
|
-
)
|
|
127
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
130
128
|
if utils.match_response(http_res, "5XX", "*"):
|
|
131
129
|
http_res_text = utils.stream_to_text(http_res)
|
|
132
|
-
raise errors.APIError(
|
|
133
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
134
|
-
)
|
|
130
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
135
131
|
|
|
136
|
-
|
|
137
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
138
|
-
raise errors.APIError(
|
|
139
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
140
|
-
http_res.status_code,
|
|
141
|
-
http_res_text,
|
|
142
|
-
http_res,
|
|
143
|
-
)
|
|
132
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
144
133
|
|
|
145
134
|
async def upsert_async(
|
|
146
135
|
self,
|
|
147
136
|
*,
|
|
148
137
|
project_name: str,
|
|
149
138
|
collection_name: str,
|
|
150
|
-
docs:
|
|
139
|
+
docs: List[Dict[str, Any]],
|
|
151
140
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
152
141
|
server_url: Optional[str] = None,
|
|
153
142
|
timeout_ms: Optional[int] = None,
|
|
@@ -177,7 +166,7 @@ class Docs(BaseSDK):
|
|
|
177
166
|
project_name=project_name,
|
|
178
167
|
collection_name=collection_name,
|
|
179
168
|
request_body=models.UpsertDocsRequestBody(
|
|
180
|
-
docs=
|
|
169
|
+
docs=docs,
|
|
181
170
|
),
|
|
182
171
|
)
|
|
183
172
|
|
|
@@ -229,51 +218,40 @@ class Docs(BaseSDK):
|
|
|
229
218
|
|
|
230
219
|
response_data: Any = None
|
|
231
220
|
if utils.match_response(http_res, "202", "application/json"):
|
|
232
|
-
return utils.
|
|
221
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
233
222
|
if utils.match_response(http_res, "400", "application/json"):
|
|
234
|
-
response_data = utils.
|
|
235
|
-
|
|
223
|
+
response_data = utils.unmarshal_json_response(
|
|
224
|
+
errors.BadRequestErrorData, http_res
|
|
236
225
|
)
|
|
237
|
-
raise errors.BadRequestError(
|
|
226
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
238
227
|
if utils.match_response(http_res, "401", "application/json"):
|
|
239
|
-
response_data = utils.
|
|
240
|
-
|
|
228
|
+
response_data = utils.unmarshal_json_response(
|
|
229
|
+
errors.UnauthenticatedErrorData, http_res
|
|
241
230
|
)
|
|
242
|
-
raise errors.UnauthenticatedError(
|
|
231
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
243
232
|
if utils.match_response(http_res, "404", "application/json"):
|
|
244
|
-
response_data = utils.
|
|
245
|
-
|
|
233
|
+
response_data = utils.unmarshal_json_response(
|
|
234
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
246
235
|
)
|
|
247
|
-
raise errors.ResourceNotFoundError(
|
|
236
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
248
237
|
if utils.match_response(http_res, "429", "application/json"):
|
|
249
|
-
response_data = utils.
|
|
250
|
-
|
|
238
|
+
response_data = utils.unmarshal_json_response(
|
|
239
|
+
errors.TooManyRequestsErrorData, http_res
|
|
251
240
|
)
|
|
252
|
-
raise errors.TooManyRequestsError(
|
|
241
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
253
242
|
if utils.match_response(http_res, "500", "application/json"):
|
|
254
|
-
response_data = utils.
|
|
255
|
-
|
|
243
|
+
response_data = utils.unmarshal_json_response(
|
|
244
|
+
errors.InternalServerErrorData, http_res
|
|
256
245
|
)
|
|
257
|
-
raise errors.InternalServerError(
|
|
246
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
258
247
|
if utils.match_response(http_res, "4XX", "*"):
|
|
259
248
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
260
|
-
raise errors.APIError(
|
|
261
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
262
|
-
)
|
|
249
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
263
250
|
if utils.match_response(http_res, "5XX", "*"):
|
|
264
251
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
265
|
-
raise errors.APIError(
|
|
266
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
267
|
-
)
|
|
252
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
268
253
|
|
|
269
|
-
|
|
270
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
271
|
-
raise errors.APIError(
|
|
272
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
273
|
-
http_res.status_code,
|
|
274
|
-
http_res_text,
|
|
275
|
-
http_res,
|
|
276
|
-
)
|
|
254
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
277
255
|
|
|
278
256
|
def get_bulk_upsert(
|
|
279
257
|
self,
|
|
@@ -354,46 +332,37 @@ class Docs(BaseSDK):
|
|
|
354
332
|
|
|
355
333
|
response_data: Any = None
|
|
356
334
|
if utils.match_response(http_res, "200", "application/json"):
|
|
357
|
-
return utils.
|
|
335
|
+
return utils.unmarshal_json_response(
|
|
336
|
+
models.GetBulkUpsertDocsResponse, http_res
|
|
337
|
+
)
|
|
358
338
|
if utils.match_response(http_res, "401", "application/json"):
|
|
359
|
-
response_data = utils.
|
|
360
|
-
|
|
339
|
+
response_data = utils.unmarshal_json_response(
|
|
340
|
+
errors.UnauthenticatedErrorData, http_res
|
|
361
341
|
)
|
|
362
|
-
raise errors.UnauthenticatedError(
|
|
342
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
363
343
|
if utils.match_response(http_res, "404", "application/json"):
|
|
364
|
-
response_data = utils.
|
|
365
|
-
|
|
344
|
+
response_data = utils.unmarshal_json_response(
|
|
345
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
366
346
|
)
|
|
367
|
-
raise errors.ResourceNotFoundError(
|
|
347
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
368
348
|
if utils.match_response(http_res, "429", "application/json"):
|
|
369
|
-
response_data = utils.
|
|
370
|
-
|
|
349
|
+
response_data = utils.unmarshal_json_response(
|
|
350
|
+
errors.TooManyRequestsErrorData, http_res
|
|
371
351
|
)
|
|
372
|
-
raise errors.TooManyRequestsError(
|
|
352
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
373
353
|
if utils.match_response(http_res, "500", "application/json"):
|
|
374
|
-
response_data = utils.
|
|
375
|
-
|
|
354
|
+
response_data = utils.unmarshal_json_response(
|
|
355
|
+
errors.InternalServerErrorData, http_res
|
|
376
356
|
)
|
|
377
|
-
raise errors.InternalServerError(
|
|
357
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
378
358
|
if utils.match_response(http_res, "4XX", "*"):
|
|
379
359
|
http_res_text = utils.stream_to_text(http_res)
|
|
380
|
-
raise errors.APIError(
|
|
381
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
382
|
-
)
|
|
360
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
383
361
|
if utils.match_response(http_res, "5XX", "*"):
|
|
384
362
|
http_res_text = utils.stream_to_text(http_res)
|
|
385
|
-
raise errors.APIError(
|
|
386
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
387
|
-
)
|
|
363
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
388
364
|
|
|
389
|
-
|
|
390
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
391
|
-
raise errors.APIError(
|
|
392
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
393
|
-
http_res.status_code,
|
|
394
|
-
http_res_text,
|
|
395
|
-
http_res,
|
|
396
|
-
)
|
|
365
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
397
366
|
|
|
398
367
|
async def get_bulk_upsert_async(
|
|
399
368
|
self,
|
|
@@ -474,46 +443,37 @@ class Docs(BaseSDK):
|
|
|
474
443
|
|
|
475
444
|
response_data: Any = None
|
|
476
445
|
if utils.match_response(http_res, "200", "application/json"):
|
|
477
|
-
return utils.
|
|
446
|
+
return utils.unmarshal_json_response(
|
|
447
|
+
models.GetBulkUpsertDocsResponse, http_res
|
|
448
|
+
)
|
|
478
449
|
if utils.match_response(http_res, "401", "application/json"):
|
|
479
|
-
response_data = utils.
|
|
480
|
-
|
|
450
|
+
response_data = utils.unmarshal_json_response(
|
|
451
|
+
errors.UnauthenticatedErrorData, http_res
|
|
481
452
|
)
|
|
482
|
-
raise errors.UnauthenticatedError(
|
|
453
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
483
454
|
if utils.match_response(http_res, "404", "application/json"):
|
|
484
|
-
response_data = utils.
|
|
485
|
-
|
|
455
|
+
response_data = utils.unmarshal_json_response(
|
|
456
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
486
457
|
)
|
|
487
|
-
raise errors.ResourceNotFoundError(
|
|
458
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
488
459
|
if utils.match_response(http_res, "429", "application/json"):
|
|
489
|
-
response_data = utils.
|
|
490
|
-
|
|
460
|
+
response_data = utils.unmarshal_json_response(
|
|
461
|
+
errors.TooManyRequestsErrorData, http_res
|
|
491
462
|
)
|
|
492
|
-
raise errors.TooManyRequestsError(
|
|
463
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
493
464
|
if utils.match_response(http_res, "500", "application/json"):
|
|
494
|
-
response_data = utils.
|
|
495
|
-
|
|
465
|
+
response_data = utils.unmarshal_json_response(
|
|
466
|
+
errors.InternalServerErrorData, http_res
|
|
496
467
|
)
|
|
497
|
-
raise errors.InternalServerError(
|
|
468
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
498
469
|
if utils.match_response(http_res, "4XX", "*"):
|
|
499
470
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
500
|
-
raise errors.APIError(
|
|
501
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
502
|
-
)
|
|
471
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
503
472
|
if utils.match_response(http_res, "5XX", "*"):
|
|
504
473
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
505
|
-
raise errors.APIError(
|
|
506
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
507
|
-
)
|
|
474
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
508
475
|
|
|
509
|
-
|
|
510
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
511
|
-
raise errors.APIError(
|
|
512
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
513
|
-
http_res.status_code,
|
|
514
|
-
http_res_text,
|
|
515
|
-
http_res,
|
|
516
|
-
)
|
|
476
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
517
477
|
|
|
518
478
|
def bulk_upsert(
|
|
519
479
|
self,
|
|
@@ -606,51 +566,40 @@ class Docs(BaseSDK):
|
|
|
606
566
|
|
|
607
567
|
response_data: Any = None
|
|
608
568
|
if utils.match_response(http_res, "202", "application/json"):
|
|
609
|
-
return utils.
|
|
569
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
610
570
|
if utils.match_response(http_res, "400", "application/json"):
|
|
611
|
-
response_data = utils.
|
|
612
|
-
|
|
571
|
+
response_data = utils.unmarshal_json_response(
|
|
572
|
+
errors.BadRequestErrorData, http_res
|
|
613
573
|
)
|
|
614
|
-
raise errors.BadRequestError(
|
|
574
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
615
575
|
if utils.match_response(http_res, "401", "application/json"):
|
|
616
|
-
response_data = utils.
|
|
617
|
-
|
|
576
|
+
response_data = utils.unmarshal_json_response(
|
|
577
|
+
errors.UnauthenticatedErrorData, http_res
|
|
618
578
|
)
|
|
619
|
-
raise errors.UnauthenticatedError(
|
|
579
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
620
580
|
if utils.match_response(http_res, "404", "application/json"):
|
|
621
|
-
response_data = utils.
|
|
622
|
-
|
|
581
|
+
response_data = utils.unmarshal_json_response(
|
|
582
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
623
583
|
)
|
|
624
|
-
raise errors.ResourceNotFoundError(
|
|
584
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
625
585
|
if utils.match_response(http_res, "429", "application/json"):
|
|
626
|
-
response_data = utils.
|
|
627
|
-
|
|
586
|
+
response_data = utils.unmarshal_json_response(
|
|
587
|
+
errors.TooManyRequestsErrorData, http_res
|
|
628
588
|
)
|
|
629
|
-
raise errors.TooManyRequestsError(
|
|
589
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
630
590
|
if utils.match_response(http_res, "500", "application/json"):
|
|
631
|
-
response_data = utils.
|
|
632
|
-
|
|
591
|
+
response_data = utils.unmarshal_json_response(
|
|
592
|
+
errors.InternalServerErrorData, http_res
|
|
633
593
|
)
|
|
634
|
-
raise errors.InternalServerError(
|
|
594
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
635
595
|
if utils.match_response(http_res, "4XX", "*"):
|
|
636
596
|
http_res_text = utils.stream_to_text(http_res)
|
|
637
|
-
raise errors.APIError(
|
|
638
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
639
|
-
)
|
|
597
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
640
598
|
if utils.match_response(http_res, "5XX", "*"):
|
|
641
599
|
http_res_text = utils.stream_to_text(http_res)
|
|
642
|
-
raise errors.APIError(
|
|
643
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
644
|
-
)
|
|
600
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
645
601
|
|
|
646
|
-
|
|
647
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
648
|
-
raise errors.APIError(
|
|
649
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
650
|
-
http_res.status_code,
|
|
651
|
-
http_res_text,
|
|
652
|
-
http_res,
|
|
653
|
-
)
|
|
602
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
654
603
|
|
|
655
604
|
async def bulk_upsert_async(
|
|
656
605
|
self,
|
|
@@ -743,58 +692,47 @@ class Docs(BaseSDK):
|
|
|
743
692
|
|
|
744
693
|
response_data: Any = None
|
|
745
694
|
if utils.match_response(http_res, "202", "application/json"):
|
|
746
|
-
return utils.
|
|
695
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
747
696
|
if utils.match_response(http_res, "400", "application/json"):
|
|
748
|
-
response_data = utils.
|
|
749
|
-
|
|
697
|
+
response_data = utils.unmarshal_json_response(
|
|
698
|
+
errors.BadRequestErrorData, http_res
|
|
750
699
|
)
|
|
751
|
-
raise errors.BadRequestError(
|
|
700
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
752
701
|
if utils.match_response(http_res, "401", "application/json"):
|
|
753
|
-
response_data = utils.
|
|
754
|
-
|
|
702
|
+
response_data = utils.unmarshal_json_response(
|
|
703
|
+
errors.UnauthenticatedErrorData, http_res
|
|
755
704
|
)
|
|
756
|
-
raise errors.UnauthenticatedError(
|
|
705
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
757
706
|
if utils.match_response(http_res, "404", "application/json"):
|
|
758
|
-
response_data = utils.
|
|
759
|
-
|
|
707
|
+
response_data = utils.unmarshal_json_response(
|
|
708
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
760
709
|
)
|
|
761
|
-
raise errors.ResourceNotFoundError(
|
|
710
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
762
711
|
if utils.match_response(http_res, "429", "application/json"):
|
|
763
|
-
response_data = utils.
|
|
764
|
-
|
|
712
|
+
response_data = utils.unmarshal_json_response(
|
|
713
|
+
errors.TooManyRequestsErrorData, http_res
|
|
765
714
|
)
|
|
766
|
-
raise errors.TooManyRequestsError(
|
|
715
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
767
716
|
if utils.match_response(http_res, "500", "application/json"):
|
|
768
|
-
response_data = utils.
|
|
769
|
-
|
|
717
|
+
response_data = utils.unmarshal_json_response(
|
|
718
|
+
errors.InternalServerErrorData, http_res
|
|
770
719
|
)
|
|
771
|
-
raise errors.InternalServerError(
|
|
720
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
772
721
|
if utils.match_response(http_res, "4XX", "*"):
|
|
773
722
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
774
|
-
raise errors.APIError(
|
|
775
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
776
|
-
)
|
|
723
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
777
724
|
if utils.match_response(http_res, "5XX", "*"):
|
|
778
725
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
779
|
-
raise errors.APIError(
|
|
780
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
781
|
-
)
|
|
726
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
782
727
|
|
|
783
|
-
|
|
784
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
785
|
-
raise errors.APIError(
|
|
786
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
787
|
-
http_res.status_code,
|
|
788
|
-
http_res_text,
|
|
789
|
-
http_res,
|
|
790
|
-
)
|
|
728
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
791
729
|
|
|
792
730
|
def update_docs(
|
|
793
731
|
self,
|
|
794
732
|
*,
|
|
795
733
|
project_name: str,
|
|
796
734
|
collection_name: str,
|
|
797
|
-
docs:
|
|
735
|
+
docs: List[Dict[str, Any]],
|
|
798
736
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
799
737
|
server_url: Optional[str] = None,
|
|
800
738
|
timeout_ms: Optional[int] = None,
|
|
@@ -824,7 +762,7 @@ class Docs(BaseSDK):
|
|
|
824
762
|
project_name=project_name,
|
|
825
763
|
collection_name=collection_name,
|
|
826
764
|
request_body=models.UpdateDocsRequestBody(
|
|
827
|
-
docs=
|
|
765
|
+
docs=docs,
|
|
828
766
|
),
|
|
829
767
|
)
|
|
830
768
|
|
|
@@ -876,58 +814,47 @@ class Docs(BaseSDK):
|
|
|
876
814
|
|
|
877
815
|
response_data: Any = None
|
|
878
816
|
if utils.match_response(http_res, "202", "application/json"):
|
|
879
|
-
return utils.
|
|
817
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
880
818
|
if utils.match_response(http_res, "400", "application/json"):
|
|
881
|
-
response_data = utils.
|
|
882
|
-
|
|
819
|
+
response_data = utils.unmarshal_json_response(
|
|
820
|
+
errors.BadRequestErrorData, http_res
|
|
883
821
|
)
|
|
884
|
-
raise errors.BadRequestError(
|
|
822
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
885
823
|
if utils.match_response(http_res, "401", "application/json"):
|
|
886
|
-
response_data = utils.
|
|
887
|
-
|
|
824
|
+
response_data = utils.unmarshal_json_response(
|
|
825
|
+
errors.UnauthenticatedErrorData, http_res
|
|
888
826
|
)
|
|
889
|
-
raise errors.UnauthenticatedError(
|
|
827
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
890
828
|
if utils.match_response(http_res, "404", "application/json"):
|
|
891
|
-
response_data = utils.
|
|
892
|
-
|
|
829
|
+
response_data = utils.unmarshal_json_response(
|
|
830
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
893
831
|
)
|
|
894
|
-
raise errors.ResourceNotFoundError(
|
|
832
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
895
833
|
if utils.match_response(http_res, "429", "application/json"):
|
|
896
|
-
response_data = utils.
|
|
897
|
-
|
|
834
|
+
response_data = utils.unmarshal_json_response(
|
|
835
|
+
errors.TooManyRequestsErrorData, http_res
|
|
898
836
|
)
|
|
899
|
-
raise errors.TooManyRequestsError(
|
|
837
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
900
838
|
if utils.match_response(http_res, "500", "application/json"):
|
|
901
|
-
response_data = utils.
|
|
902
|
-
|
|
839
|
+
response_data = utils.unmarshal_json_response(
|
|
840
|
+
errors.InternalServerErrorData, http_res
|
|
903
841
|
)
|
|
904
|
-
raise errors.InternalServerError(
|
|
842
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
905
843
|
if utils.match_response(http_res, "4XX", "*"):
|
|
906
844
|
http_res_text = utils.stream_to_text(http_res)
|
|
907
|
-
raise errors.APIError(
|
|
908
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
909
|
-
)
|
|
845
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
910
846
|
if utils.match_response(http_res, "5XX", "*"):
|
|
911
847
|
http_res_text = utils.stream_to_text(http_res)
|
|
912
|
-
raise errors.APIError(
|
|
913
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
914
|
-
)
|
|
848
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
915
849
|
|
|
916
|
-
|
|
917
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
918
|
-
raise errors.APIError(
|
|
919
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
920
|
-
http_res.status_code,
|
|
921
|
-
http_res_text,
|
|
922
|
-
http_res,
|
|
923
|
-
)
|
|
850
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
924
851
|
|
|
925
852
|
async def update_docs_async(
|
|
926
853
|
self,
|
|
927
854
|
*,
|
|
928
855
|
project_name: str,
|
|
929
856
|
collection_name: str,
|
|
930
|
-
docs:
|
|
857
|
+
docs: List[Dict[str, Any]],
|
|
931
858
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
932
859
|
server_url: Optional[str] = None,
|
|
933
860
|
timeout_ms: Optional[int] = None,
|
|
@@ -957,7 +884,7 @@ class Docs(BaseSDK):
|
|
|
957
884
|
project_name=project_name,
|
|
958
885
|
collection_name=collection_name,
|
|
959
886
|
request_body=models.UpdateDocsRequestBody(
|
|
960
|
-
docs=
|
|
887
|
+
docs=docs,
|
|
961
888
|
),
|
|
962
889
|
)
|
|
963
890
|
|
|
@@ -1009,51 +936,40 @@ class Docs(BaseSDK):
|
|
|
1009
936
|
|
|
1010
937
|
response_data: Any = None
|
|
1011
938
|
if utils.match_response(http_res, "202", "application/json"):
|
|
1012
|
-
return utils.
|
|
939
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
1013
940
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1014
|
-
response_data = utils.
|
|
1015
|
-
|
|
941
|
+
response_data = utils.unmarshal_json_response(
|
|
942
|
+
errors.BadRequestErrorData, http_res
|
|
1016
943
|
)
|
|
1017
|
-
raise errors.BadRequestError(
|
|
944
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1018
945
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1019
|
-
response_data = utils.
|
|
1020
|
-
|
|
946
|
+
response_data = utils.unmarshal_json_response(
|
|
947
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1021
948
|
)
|
|
1022
|
-
raise errors.UnauthenticatedError(
|
|
949
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1023
950
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1024
|
-
response_data = utils.
|
|
1025
|
-
|
|
951
|
+
response_data = utils.unmarshal_json_response(
|
|
952
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1026
953
|
)
|
|
1027
|
-
raise errors.ResourceNotFoundError(
|
|
954
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1028
955
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1029
|
-
response_data = utils.
|
|
1030
|
-
|
|
956
|
+
response_data = utils.unmarshal_json_response(
|
|
957
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1031
958
|
)
|
|
1032
|
-
raise errors.TooManyRequestsError(
|
|
959
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1033
960
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1034
|
-
response_data = utils.
|
|
1035
|
-
|
|
961
|
+
response_data = utils.unmarshal_json_response(
|
|
962
|
+
errors.InternalServerErrorData, http_res
|
|
1036
963
|
)
|
|
1037
|
-
raise errors.InternalServerError(
|
|
964
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1038
965
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1039
966
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1040
|
-
raise errors.APIError(
|
|
1041
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1042
|
-
)
|
|
967
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1043
968
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1044
969
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1045
|
-
raise errors.APIError(
|
|
1046
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1047
|
-
)
|
|
970
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1048
971
|
|
|
1049
|
-
|
|
1050
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1051
|
-
raise errors.APIError(
|
|
1052
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1053
|
-
http_res.status_code,
|
|
1054
|
-
http_res_text,
|
|
1055
|
-
http_res,
|
|
1056
|
-
)
|
|
972
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1057
973
|
|
|
1058
974
|
def delete(
|
|
1059
975
|
self,
|
|
@@ -1061,7 +977,7 @@ class Docs(BaseSDK):
|
|
|
1061
977
|
project_name: str,
|
|
1062
978
|
collection_name: str,
|
|
1063
979
|
ids: Optional[List[str]] = None,
|
|
1064
|
-
filter_: Optional[
|
|
980
|
+
filter_: Optional[Dict[str, Any]] = None,
|
|
1065
981
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1066
982
|
server_url: Optional[str] = None,
|
|
1067
983
|
timeout_ms: Optional[int] = None,
|
|
@@ -1093,7 +1009,7 @@ class Docs(BaseSDK):
|
|
|
1093
1009
|
collection_name=collection_name,
|
|
1094
1010
|
request_body=models.DeleteDocsRequestBody(
|
|
1095
1011
|
ids=ids,
|
|
1096
|
-
filter_=
|
|
1012
|
+
filter_=filter_,
|
|
1097
1013
|
),
|
|
1098
1014
|
)
|
|
1099
1015
|
|
|
@@ -1145,51 +1061,40 @@ class Docs(BaseSDK):
|
|
|
1145
1061
|
|
|
1146
1062
|
response_data: Any = None
|
|
1147
1063
|
if utils.match_response(http_res, "202", "application/json"):
|
|
1148
|
-
return utils.
|
|
1064
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
1149
1065
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1150
|
-
response_data = utils.
|
|
1151
|
-
|
|
1066
|
+
response_data = utils.unmarshal_json_response(
|
|
1067
|
+
errors.BadRequestErrorData, http_res
|
|
1152
1068
|
)
|
|
1153
|
-
raise errors.BadRequestError(
|
|
1069
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1154
1070
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1155
|
-
response_data = utils.
|
|
1156
|
-
|
|
1071
|
+
response_data = utils.unmarshal_json_response(
|
|
1072
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1157
1073
|
)
|
|
1158
|
-
raise errors.UnauthenticatedError(
|
|
1074
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1159
1075
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1160
|
-
response_data = utils.
|
|
1161
|
-
|
|
1076
|
+
response_data = utils.unmarshal_json_response(
|
|
1077
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1162
1078
|
)
|
|
1163
|
-
raise errors.ResourceNotFoundError(
|
|
1079
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1164
1080
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1165
|
-
response_data = utils.
|
|
1166
|
-
|
|
1081
|
+
response_data = utils.unmarshal_json_response(
|
|
1082
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1167
1083
|
)
|
|
1168
|
-
raise errors.TooManyRequestsError(
|
|
1084
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1169
1085
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1170
|
-
response_data = utils.
|
|
1171
|
-
|
|
1086
|
+
response_data = utils.unmarshal_json_response(
|
|
1087
|
+
errors.InternalServerErrorData, http_res
|
|
1172
1088
|
)
|
|
1173
|
-
raise errors.InternalServerError(
|
|
1089
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1174
1090
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1175
1091
|
http_res_text = utils.stream_to_text(http_res)
|
|
1176
|
-
raise errors.APIError(
|
|
1177
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1178
|
-
)
|
|
1092
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1179
1093
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1180
1094
|
http_res_text = utils.stream_to_text(http_res)
|
|
1181
|
-
raise errors.APIError(
|
|
1182
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1183
|
-
)
|
|
1095
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1184
1096
|
|
|
1185
|
-
|
|
1186
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1187
|
-
raise errors.APIError(
|
|
1188
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1189
|
-
http_res.status_code,
|
|
1190
|
-
http_res_text,
|
|
1191
|
-
http_res,
|
|
1192
|
-
)
|
|
1097
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1193
1098
|
|
|
1194
1099
|
async def delete_async(
|
|
1195
1100
|
self,
|
|
@@ -1197,7 +1102,7 @@ class Docs(BaseSDK):
|
|
|
1197
1102
|
project_name: str,
|
|
1198
1103
|
collection_name: str,
|
|
1199
1104
|
ids: Optional[List[str]] = None,
|
|
1200
|
-
filter_: Optional[
|
|
1105
|
+
filter_: Optional[Dict[str, Any]] = None,
|
|
1201
1106
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1202
1107
|
server_url: Optional[str] = None,
|
|
1203
1108
|
timeout_ms: Optional[int] = None,
|
|
@@ -1229,7 +1134,7 @@ class Docs(BaseSDK):
|
|
|
1229
1134
|
collection_name=collection_name,
|
|
1230
1135
|
request_body=models.DeleteDocsRequestBody(
|
|
1231
1136
|
ids=ids,
|
|
1232
|
-
filter_=
|
|
1137
|
+
filter_=filter_,
|
|
1233
1138
|
),
|
|
1234
1139
|
)
|
|
1235
1140
|
|
|
@@ -1281,51 +1186,40 @@ class Docs(BaseSDK):
|
|
|
1281
1186
|
|
|
1282
1187
|
response_data: Any = None
|
|
1283
1188
|
if utils.match_response(http_res, "202", "application/json"):
|
|
1284
|
-
return utils.
|
|
1189
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
1285
1190
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1286
|
-
response_data = utils.
|
|
1287
|
-
|
|
1191
|
+
response_data = utils.unmarshal_json_response(
|
|
1192
|
+
errors.BadRequestErrorData, http_res
|
|
1288
1193
|
)
|
|
1289
|
-
raise errors.BadRequestError(
|
|
1194
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1290
1195
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1291
|
-
response_data = utils.
|
|
1292
|
-
|
|
1196
|
+
response_data = utils.unmarshal_json_response(
|
|
1197
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1293
1198
|
)
|
|
1294
|
-
raise errors.UnauthenticatedError(
|
|
1199
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1295
1200
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1296
|
-
response_data = utils.
|
|
1297
|
-
|
|
1201
|
+
response_data = utils.unmarshal_json_response(
|
|
1202
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1298
1203
|
)
|
|
1299
|
-
raise errors.ResourceNotFoundError(
|
|
1204
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1300
1205
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1301
|
-
response_data = utils.
|
|
1302
|
-
|
|
1206
|
+
response_data = utils.unmarshal_json_response(
|
|
1207
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1303
1208
|
)
|
|
1304
|
-
raise errors.TooManyRequestsError(
|
|
1209
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1305
1210
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1306
|
-
response_data = utils.
|
|
1307
|
-
|
|
1211
|
+
response_data = utils.unmarshal_json_response(
|
|
1212
|
+
errors.InternalServerErrorData, http_res
|
|
1308
1213
|
)
|
|
1309
|
-
raise errors.InternalServerError(
|
|
1214
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1310
1215
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1311
1216
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1312
|
-
raise errors.APIError(
|
|
1313
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1314
|
-
)
|
|
1217
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1315
1218
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1316
1219
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1317
|
-
raise errors.APIError(
|
|
1318
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1319
|
-
)
|
|
1220
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1320
1221
|
|
|
1321
|
-
|
|
1322
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1323
|
-
raise errors.APIError(
|
|
1324
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1325
|
-
http_res.status_code,
|
|
1326
|
-
http_res_text,
|
|
1327
|
-
http_res,
|
|
1328
|
-
)
|
|
1222
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1329
1223
|
|
|
1330
1224
|
def fetch(
|
|
1331
1225
|
self,
|
|
@@ -1420,51 +1314,40 @@ class Docs(BaseSDK):
|
|
|
1420
1314
|
|
|
1421
1315
|
response_data: Any = None
|
|
1422
1316
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1423
|
-
return utils.
|
|
1317
|
+
return utils.unmarshal_json_response(models.FetchDocsResponse, http_res)
|
|
1424
1318
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1425
|
-
response_data = utils.
|
|
1426
|
-
|
|
1319
|
+
response_data = utils.unmarshal_json_response(
|
|
1320
|
+
errors.BadRequestErrorData, http_res
|
|
1427
1321
|
)
|
|
1428
|
-
raise errors.BadRequestError(
|
|
1322
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1429
1323
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1430
|
-
response_data = utils.
|
|
1431
|
-
|
|
1324
|
+
response_data = utils.unmarshal_json_response(
|
|
1325
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1432
1326
|
)
|
|
1433
|
-
raise errors.UnauthenticatedError(
|
|
1327
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1434
1328
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1435
|
-
response_data = utils.
|
|
1436
|
-
|
|
1329
|
+
response_data = utils.unmarshal_json_response(
|
|
1330
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1437
1331
|
)
|
|
1438
|
-
raise errors.ResourceNotFoundError(
|
|
1332
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1439
1333
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1440
|
-
response_data = utils.
|
|
1441
|
-
|
|
1334
|
+
response_data = utils.unmarshal_json_response(
|
|
1335
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1442
1336
|
)
|
|
1443
|
-
raise errors.TooManyRequestsError(
|
|
1337
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1444
1338
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1445
|
-
response_data = utils.
|
|
1446
|
-
|
|
1339
|
+
response_data = utils.unmarshal_json_response(
|
|
1340
|
+
errors.InternalServerErrorData, http_res
|
|
1447
1341
|
)
|
|
1448
|
-
raise errors.InternalServerError(
|
|
1342
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1449
1343
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1450
1344
|
http_res_text = utils.stream_to_text(http_res)
|
|
1451
|
-
raise errors.APIError(
|
|
1452
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1453
|
-
)
|
|
1345
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1454
1346
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1455
1347
|
http_res_text = utils.stream_to_text(http_res)
|
|
1456
|
-
raise errors.APIError(
|
|
1457
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1458
|
-
)
|
|
1348
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1459
1349
|
|
|
1460
|
-
|
|
1461
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1462
|
-
raise errors.APIError(
|
|
1463
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1464
|
-
http_res.status_code,
|
|
1465
|
-
http_res_text,
|
|
1466
|
-
http_res,
|
|
1467
|
-
)
|
|
1350
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1468
1351
|
|
|
1469
1352
|
async def fetch_async(
|
|
1470
1353
|
self,
|
|
@@ -1559,48 +1442,37 @@ class Docs(BaseSDK):
|
|
|
1559
1442
|
|
|
1560
1443
|
response_data: Any = None
|
|
1561
1444
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1562
|
-
return utils.
|
|
1445
|
+
return utils.unmarshal_json_response(models.FetchDocsResponse, http_res)
|
|
1563
1446
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1564
|
-
response_data = utils.
|
|
1565
|
-
|
|
1447
|
+
response_data = utils.unmarshal_json_response(
|
|
1448
|
+
errors.BadRequestErrorData, http_res
|
|
1566
1449
|
)
|
|
1567
|
-
raise errors.BadRequestError(
|
|
1450
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1568
1451
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1569
|
-
response_data = utils.
|
|
1570
|
-
|
|
1452
|
+
response_data = utils.unmarshal_json_response(
|
|
1453
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1571
1454
|
)
|
|
1572
|
-
raise errors.UnauthenticatedError(
|
|
1455
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1573
1456
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1574
|
-
response_data = utils.
|
|
1575
|
-
|
|
1457
|
+
response_data = utils.unmarshal_json_response(
|
|
1458
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1576
1459
|
)
|
|
1577
|
-
raise errors.ResourceNotFoundError(
|
|
1460
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1578
1461
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1579
|
-
response_data = utils.
|
|
1580
|
-
|
|
1462
|
+
response_data = utils.unmarshal_json_response(
|
|
1463
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1581
1464
|
)
|
|
1582
|
-
raise errors.TooManyRequestsError(
|
|
1465
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1583
1466
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1584
|
-
response_data = utils.
|
|
1585
|
-
|
|
1467
|
+
response_data = utils.unmarshal_json_response(
|
|
1468
|
+
errors.InternalServerErrorData, http_res
|
|
1586
1469
|
)
|
|
1587
|
-
raise errors.InternalServerError(
|
|
1470
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1588
1471
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1589
1472
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1590
|
-
raise errors.APIError(
|
|
1591
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1592
|
-
)
|
|
1473
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1593
1474
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1594
1475
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1595
|
-
raise errors.APIError(
|
|
1596
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1597
|
-
)
|
|
1476
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1598
1477
|
|
|
1599
|
-
|
|
1600
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1601
|
-
raise errors.APIError(
|
|
1602
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1603
|
-
http_res.status_code,
|
|
1604
|
-
http_res_text,
|
|
1605
|
-
http_res,
|
|
1606
|
-
)
|
|
1478
|
+
raise errors.APIError("Unexpected response received", http_res)
|