lambdadb 0.3.5__py3-none-any.whl → 0.4.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.

Potentially problematic release.


This version of lambdadb might be problematic. Click here for more details.

Files changed (37) hide show
  1. lambdadb/_version.py +3 -3
  2. lambdadb/basesdk.py +4 -4
  3. lambdadb/collections.py +280 -452
  4. lambdadb/docs.py +261 -425
  5. lambdadb/errors/__init__.py +9 -0
  6. lambdadb/errors/apierror.py +30 -14
  7. lambdadb/errors/badrequest_error.py +12 -6
  8. lambdadb/errors/internalservererror.py +12 -6
  9. lambdadb/errors/lambdadberror.py +26 -0
  10. lambdadb/errors/no_response_error.py +13 -0
  11. lambdadb/errors/resourcealreadyexists_error.py +12 -6
  12. lambdadb/errors/resourcenotfound_error.py +12 -6
  13. lambdadb/errors/responsevalidationerror.py +25 -0
  14. lambdadb/errors/toomanyrequests_error.py +12 -6
  15. lambdadb/errors/unauthenticated_error.py +12 -6
  16. lambdadb/models/__init__.py +0 -54
  17. lambdadb/models/bulkupsertdocsop.py +0 -9
  18. lambdadb/models/createcollectionop.py +2 -23
  19. lambdadb/models/deletecollectionop.py +0 -9
  20. lambdadb/models/deletedocsop.py +3 -20
  21. lambdadb/models/fetchdocsop.py +3 -20
  22. lambdadb/models/getbulkupsertdocsop.py +0 -9
  23. lambdadb/models/getcollectionop.py +0 -9
  24. lambdadb/models/listcollectionsop.py +1 -17
  25. lambdadb/models/querycollectionop.py +7 -40
  26. lambdadb/models/updatecollectionop.py +0 -9
  27. lambdadb/models/updatedocsop.py +3 -20
  28. lambdadb/models/upsertdocsop.py +3 -20
  29. lambdadb/sdk.py +9 -1
  30. lambdadb/sdkconfiguration.py +4 -3
  31. lambdadb/utils/__init__.py +3 -0
  32. lambdadb/utils/serializers.py +21 -3
  33. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/METADATA +94 -55
  34. lambdadb-0.4.0.dist-info/RECORD +64 -0
  35. lambdadb-0.3.5.dist-info/RECORD +0 -61
  36. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/LICENSE +0 -0
  37. {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/WHEEL +0 -0
lambdadb/docs.py CHANGED
@@ -5,16 +5,15 @@ 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, Union
8
+ from typing import Any, Dict, List, Mapping, Optional
9
9
 
10
10
 
11
11
  class Docs(BaseSDK):
12
- def upsert(
12
+ def upsert_docs(
13
13
  self,
14
14
  *,
15
- project_name: str,
16
15
  collection_name: str,
17
- docs: Union[List[models.UpsertDocsDoc], List[models.UpsertDocsDocTypedDict]],
16
+ docs: List[Dict[str, Any]],
18
17
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
18
  server_url: Optional[str] = None,
20
19
  timeout_ms: Optional[int] = None,
@@ -22,7 +21,6 @@ class Docs(BaseSDK):
22
21
  ) -> models.MessageResponse:
23
22
  r"""Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
24
23
 
25
- :param project_name: Project name.
26
24
  :param collection_name: Collection name.
27
25
  :param docs: A list of documents to upsert.
28
26
  :param retries: Override the default retry configuration for this method
@@ -41,16 +39,15 @@ class Docs(BaseSDK):
41
39
  base_url = self._get_url(base_url, url_variables)
42
40
 
43
41
  request = models.UpsertDocsRequest(
44
- project_name=project_name,
45
42
  collection_name=collection_name,
46
43
  request_body=models.UpsertDocsRequestBody(
47
- docs=utils.get_pydantic_model(docs, List[models.UpsertDocsDoc]),
44
+ docs=docs,
48
45
  ),
49
46
  )
50
47
 
51
48
  req = self._build_request(
52
49
  method="POST",
53
- path="/projects/{projectName}/collections/{collectionName}/docs/upsert",
50
+ path="/collections/{collectionName}/docs/upsert",
54
51
  base_url=base_url,
55
52
  url_variables=url_variables,
56
53
  request=request,
@@ -96,58 +93,46 @@ class Docs(BaseSDK):
96
93
 
97
94
  response_data: Any = None
98
95
  if utils.match_response(http_res, "202", "application/json"):
99
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
96
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
100
97
  if utils.match_response(http_res, "400", "application/json"):
101
- response_data = utils.unmarshal_json(
102
- http_res.text, errors.BadRequestErrorData
98
+ response_data = utils.unmarshal_json_response(
99
+ errors.BadRequestErrorData, http_res
103
100
  )
104
- raise errors.BadRequestError(data=response_data)
101
+ raise errors.BadRequestError(response_data, http_res)
105
102
  if utils.match_response(http_res, "401", "application/json"):
106
- response_data = utils.unmarshal_json(
107
- http_res.text, errors.UnauthenticatedErrorData
103
+ response_data = utils.unmarshal_json_response(
104
+ errors.UnauthenticatedErrorData, http_res
108
105
  )
109
- raise errors.UnauthenticatedError(data=response_data)
106
+ raise errors.UnauthenticatedError(response_data, http_res)
110
107
  if utils.match_response(http_res, "404", "application/json"):
111
- response_data = utils.unmarshal_json(
112
- http_res.text, errors.ResourceNotFoundErrorData
108
+ response_data = utils.unmarshal_json_response(
109
+ errors.ResourceNotFoundErrorData, http_res
113
110
  )
114
- raise errors.ResourceNotFoundError(data=response_data)
111
+ raise errors.ResourceNotFoundError(response_data, http_res)
115
112
  if utils.match_response(http_res, "429", "application/json"):
116
- response_data = utils.unmarshal_json(
117
- http_res.text, errors.TooManyRequestsErrorData
113
+ response_data = utils.unmarshal_json_response(
114
+ errors.TooManyRequestsErrorData, http_res
118
115
  )
119
- raise errors.TooManyRequestsError(data=response_data)
116
+ raise errors.TooManyRequestsError(response_data, http_res)
120
117
  if utils.match_response(http_res, "500", "application/json"):
121
- response_data = utils.unmarshal_json(
122
- http_res.text, errors.InternalServerErrorData
118
+ response_data = utils.unmarshal_json_response(
119
+ errors.InternalServerErrorData, http_res
123
120
  )
124
- raise errors.InternalServerError(data=response_data)
121
+ raise errors.InternalServerError(response_data, http_res)
125
122
  if utils.match_response(http_res, "4XX", "*"):
126
123
  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
- )
124
+ raise errors.APIError("API error occurred", http_res, http_res_text)
130
125
  if utils.match_response(http_res, "5XX", "*"):
131
126
  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
- )
127
+ raise errors.APIError("API error occurred", http_res, http_res_text)
135
128
 
136
- content_type = http_res.headers.get("Content-Type")
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
- )
129
+ raise errors.APIError("Unexpected response received", http_res)
144
130
 
145
- async def upsert_async(
131
+ async def upsert_docs_async(
146
132
  self,
147
133
  *,
148
- project_name: str,
149
134
  collection_name: str,
150
- docs: Union[List[models.UpsertDocsDoc], List[models.UpsertDocsDocTypedDict]],
135
+ docs: List[Dict[str, Any]],
151
136
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
152
137
  server_url: Optional[str] = None,
153
138
  timeout_ms: Optional[int] = None,
@@ -155,7 +140,6 @@ class Docs(BaseSDK):
155
140
  ) -> models.MessageResponse:
156
141
  r"""Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
157
142
 
158
- :param project_name: Project name.
159
143
  :param collection_name: Collection name.
160
144
  :param docs: A list of documents to upsert.
161
145
  :param retries: Override the default retry configuration for this method
@@ -174,16 +158,15 @@ class Docs(BaseSDK):
174
158
  base_url = self._get_url(base_url, url_variables)
175
159
 
176
160
  request = models.UpsertDocsRequest(
177
- project_name=project_name,
178
161
  collection_name=collection_name,
179
162
  request_body=models.UpsertDocsRequestBody(
180
- docs=utils.get_pydantic_model(docs, List[models.UpsertDocsDoc]),
163
+ docs=docs,
181
164
  ),
182
165
  )
183
166
 
184
167
  req = self._build_request_async(
185
168
  method="POST",
186
- path="/projects/{projectName}/collections/{collectionName}/docs/upsert",
169
+ path="/collections/{collectionName}/docs/upsert",
187
170
  base_url=base_url,
188
171
  url_variables=url_variables,
189
172
  request=request,
@@ -229,56 +212,44 @@ class Docs(BaseSDK):
229
212
 
230
213
  response_data: Any = None
231
214
  if utils.match_response(http_res, "202", "application/json"):
232
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
215
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
233
216
  if utils.match_response(http_res, "400", "application/json"):
234
- response_data = utils.unmarshal_json(
235
- http_res.text, errors.BadRequestErrorData
217
+ response_data = utils.unmarshal_json_response(
218
+ errors.BadRequestErrorData, http_res
236
219
  )
237
- raise errors.BadRequestError(data=response_data)
220
+ raise errors.BadRequestError(response_data, http_res)
238
221
  if utils.match_response(http_res, "401", "application/json"):
239
- response_data = utils.unmarshal_json(
240
- http_res.text, errors.UnauthenticatedErrorData
222
+ response_data = utils.unmarshal_json_response(
223
+ errors.UnauthenticatedErrorData, http_res
241
224
  )
242
- raise errors.UnauthenticatedError(data=response_data)
225
+ raise errors.UnauthenticatedError(response_data, http_res)
243
226
  if utils.match_response(http_res, "404", "application/json"):
244
- response_data = utils.unmarshal_json(
245
- http_res.text, errors.ResourceNotFoundErrorData
227
+ response_data = utils.unmarshal_json_response(
228
+ errors.ResourceNotFoundErrorData, http_res
246
229
  )
247
- raise errors.ResourceNotFoundError(data=response_data)
230
+ raise errors.ResourceNotFoundError(response_data, http_res)
248
231
  if utils.match_response(http_res, "429", "application/json"):
249
- response_data = utils.unmarshal_json(
250
- http_res.text, errors.TooManyRequestsErrorData
232
+ response_data = utils.unmarshal_json_response(
233
+ errors.TooManyRequestsErrorData, http_res
251
234
  )
252
- raise errors.TooManyRequestsError(data=response_data)
235
+ raise errors.TooManyRequestsError(response_data, http_res)
253
236
  if utils.match_response(http_res, "500", "application/json"):
254
- response_data = utils.unmarshal_json(
255
- http_res.text, errors.InternalServerErrorData
237
+ response_data = utils.unmarshal_json_response(
238
+ errors.InternalServerErrorData, http_res
256
239
  )
257
- raise errors.InternalServerError(data=response_data)
240
+ raise errors.InternalServerError(response_data, http_res)
258
241
  if utils.match_response(http_res, "4XX", "*"):
259
242
  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
- )
243
+ raise errors.APIError("API error occurred", http_res, http_res_text)
263
244
  if utils.match_response(http_res, "5XX", "*"):
264
245
  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
- )
246
+ raise errors.APIError("API error occurred", http_res, http_res_text)
268
247
 
269
- content_type = http_res.headers.get("Content-Type")
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
- )
248
+ raise errors.APIError("Unexpected response received", http_res)
277
249
 
278
- def get_bulk_upsert(
250
+ def get_bulk_upsert_docs(
279
251
  self,
280
252
  *,
281
- project_name: str,
282
253
  collection_name: str,
283
254
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
284
255
  server_url: Optional[str] = None,
@@ -287,7 +258,6 @@ class Docs(BaseSDK):
287
258
  ) -> models.GetBulkUpsertDocsResponse:
288
259
  r"""Request required info to upload documents.
289
260
 
290
- :param project_name: Project name.
291
261
  :param collection_name: Collection name.
292
262
  :param retries: Override the default retry configuration for this method
293
263
  :param server_url: Override the default server URL for this method
@@ -305,13 +275,12 @@ class Docs(BaseSDK):
305
275
  base_url = self._get_url(base_url, url_variables)
306
276
 
307
277
  request = models.GetBulkUpsertDocsRequest(
308
- project_name=project_name,
309
278
  collection_name=collection_name,
310
279
  )
311
280
 
312
281
  req = self._build_request(
313
282
  method="GET",
314
- path="/projects/{projectName}/collections/{collectionName}/docs/bulk-upsert",
283
+ path="/collections/{collectionName}/docs/bulk-upsert",
315
284
  base_url=base_url,
316
285
  url_variables=url_variables,
317
286
  request=request,
@@ -354,51 +323,41 @@ class Docs(BaseSDK):
354
323
 
355
324
  response_data: Any = None
356
325
  if utils.match_response(http_res, "200", "application/json"):
357
- return utils.unmarshal_json(http_res.text, models.GetBulkUpsertDocsResponse)
326
+ return utils.unmarshal_json_response(
327
+ models.GetBulkUpsertDocsResponse, http_res
328
+ )
358
329
  if utils.match_response(http_res, "401", "application/json"):
359
- response_data = utils.unmarshal_json(
360
- http_res.text, errors.UnauthenticatedErrorData
330
+ response_data = utils.unmarshal_json_response(
331
+ errors.UnauthenticatedErrorData, http_res
361
332
  )
362
- raise errors.UnauthenticatedError(data=response_data)
333
+ raise errors.UnauthenticatedError(response_data, http_res)
363
334
  if utils.match_response(http_res, "404", "application/json"):
364
- response_data = utils.unmarshal_json(
365
- http_res.text, errors.ResourceNotFoundErrorData
335
+ response_data = utils.unmarshal_json_response(
336
+ errors.ResourceNotFoundErrorData, http_res
366
337
  )
367
- raise errors.ResourceNotFoundError(data=response_data)
338
+ raise errors.ResourceNotFoundError(response_data, http_res)
368
339
  if utils.match_response(http_res, "429", "application/json"):
369
- response_data = utils.unmarshal_json(
370
- http_res.text, errors.TooManyRequestsErrorData
340
+ response_data = utils.unmarshal_json_response(
341
+ errors.TooManyRequestsErrorData, http_res
371
342
  )
372
- raise errors.TooManyRequestsError(data=response_data)
343
+ raise errors.TooManyRequestsError(response_data, http_res)
373
344
  if utils.match_response(http_res, "500", "application/json"):
374
- response_data = utils.unmarshal_json(
375
- http_res.text, errors.InternalServerErrorData
345
+ response_data = utils.unmarshal_json_response(
346
+ errors.InternalServerErrorData, http_res
376
347
  )
377
- raise errors.InternalServerError(data=response_data)
348
+ raise errors.InternalServerError(response_data, http_res)
378
349
  if utils.match_response(http_res, "4XX", "*"):
379
350
  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
- )
351
+ raise errors.APIError("API error occurred", http_res, http_res_text)
383
352
  if utils.match_response(http_res, "5XX", "*"):
384
353
  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
- )
354
+ raise errors.APIError("API error occurred", http_res, http_res_text)
388
355
 
389
- content_type = http_res.headers.get("Content-Type")
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
- )
356
+ raise errors.APIError("Unexpected response received", http_res)
397
357
 
398
- async def get_bulk_upsert_async(
358
+ async def get_bulk_upsert_docs_async(
399
359
  self,
400
360
  *,
401
- project_name: str,
402
361
  collection_name: str,
403
362
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
404
363
  server_url: Optional[str] = None,
@@ -407,7 +366,6 @@ class Docs(BaseSDK):
407
366
  ) -> models.GetBulkUpsertDocsResponse:
408
367
  r"""Request required info to upload documents.
409
368
 
410
- :param project_name: Project name.
411
369
  :param collection_name: Collection name.
412
370
  :param retries: Override the default retry configuration for this method
413
371
  :param server_url: Override the default server URL for this method
@@ -425,13 +383,12 @@ class Docs(BaseSDK):
425
383
  base_url = self._get_url(base_url, url_variables)
426
384
 
427
385
  request = models.GetBulkUpsertDocsRequest(
428
- project_name=project_name,
429
386
  collection_name=collection_name,
430
387
  )
431
388
 
432
389
  req = self._build_request_async(
433
390
  method="GET",
434
- path="/projects/{projectName}/collections/{collectionName}/docs/bulk-upsert",
391
+ path="/collections/{collectionName}/docs/bulk-upsert",
435
392
  base_url=base_url,
436
393
  url_variables=url_variables,
437
394
  request=request,
@@ -474,51 +431,41 @@ class Docs(BaseSDK):
474
431
 
475
432
  response_data: Any = None
476
433
  if utils.match_response(http_res, "200", "application/json"):
477
- return utils.unmarshal_json(http_res.text, models.GetBulkUpsertDocsResponse)
434
+ return utils.unmarshal_json_response(
435
+ models.GetBulkUpsertDocsResponse, http_res
436
+ )
478
437
  if utils.match_response(http_res, "401", "application/json"):
479
- response_data = utils.unmarshal_json(
480
- http_res.text, errors.UnauthenticatedErrorData
438
+ response_data = utils.unmarshal_json_response(
439
+ errors.UnauthenticatedErrorData, http_res
481
440
  )
482
- raise errors.UnauthenticatedError(data=response_data)
441
+ raise errors.UnauthenticatedError(response_data, http_res)
483
442
  if utils.match_response(http_res, "404", "application/json"):
484
- response_data = utils.unmarshal_json(
485
- http_res.text, errors.ResourceNotFoundErrorData
443
+ response_data = utils.unmarshal_json_response(
444
+ errors.ResourceNotFoundErrorData, http_res
486
445
  )
487
- raise errors.ResourceNotFoundError(data=response_data)
446
+ raise errors.ResourceNotFoundError(response_data, http_res)
488
447
  if utils.match_response(http_res, "429", "application/json"):
489
- response_data = utils.unmarshal_json(
490
- http_res.text, errors.TooManyRequestsErrorData
448
+ response_data = utils.unmarshal_json_response(
449
+ errors.TooManyRequestsErrorData, http_res
491
450
  )
492
- raise errors.TooManyRequestsError(data=response_data)
451
+ raise errors.TooManyRequestsError(response_data, http_res)
493
452
  if utils.match_response(http_res, "500", "application/json"):
494
- response_data = utils.unmarshal_json(
495
- http_res.text, errors.InternalServerErrorData
453
+ response_data = utils.unmarshal_json_response(
454
+ errors.InternalServerErrorData, http_res
496
455
  )
497
- raise errors.InternalServerError(data=response_data)
456
+ raise errors.InternalServerError(response_data, http_res)
498
457
  if utils.match_response(http_res, "4XX", "*"):
499
458
  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
- )
459
+ raise errors.APIError("API error occurred", http_res, http_res_text)
503
460
  if utils.match_response(http_res, "5XX", "*"):
504
461
  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
- )
462
+ raise errors.APIError("API error occurred", http_res, http_res_text)
508
463
 
509
- content_type = http_res.headers.get("Content-Type")
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
- )
464
+ raise errors.APIError("Unexpected response received", http_res)
517
465
 
518
- def bulk_upsert(
466
+ def bulk_upsert_docs(
519
467
  self,
520
468
  *,
521
- project_name: str,
522
469
  collection_name: str,
523
470
  object_key: str,
524
471
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -528,7 +475,6 @@ class Docs(BaseSDK):
528
475
  ) -> models.MessageResponse:
529
476
  r"""Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
530
477
 
531
- :param project_name: Project name.
532
478
  :param collection_name: Collection name.
533
479
  :param object_key: Object key uploaded based on bulk upsert info.
534
480
  :param retries: Override the default retry configuration for this method
@@ -547,7 +493,6 @@ class Docs(BaseSDK):
547
493
  base_url = self._get_url(base_url, url_variables)
548
494
 
549
495
  request = models.BulkUpsertDocsRequest(
550
- project_name=project_name,
551
496
  collection_name=collection_name,
552
497
  request_body=models.BulkUpsertDocsRequestBody(
553
498
  object_key=object_key,
@@ -556,7 +501,7 @@ class Docs(BaseSDK):
556
501
 
557
502
  req = self._build_request(
558
503
  method="POST",
559
- path="/projects/{projectName}/collections/{collectionName}/docs/bulk-upsert",
504
+ path="/collections/{collectionName}/docs/bulk-upsert",
560
505
  base_url=base_url,
561
506
  url_variables=url_variables,
562
507
  request=request,
@@ -606,56 +551,44 @@ class Docs(BaseSDK):
606
551
 
607
552
  response_data: Any = None
608
553
  if utils.match_response(http_res, "202", "application/json"):
609
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
554
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
610
555
  if utils.match_response(http_res, "400", "application/json"):
611
- response_data = utils.unmarshal_json(
612
- http_res.text, errors.BadRequestErrorData
556
+ response_data = utils.unmarshal_json_response(
557
+ errors.BadRequestErrorData, http_res
613
558
  )
614
- raise errors.BadRequestError(data=response_data)
559
+ raise errors.BadRequestError(response_data, http_res)
615
560
  if utils.match_response(http_res, "401", "application/json"):
616
- response_data = utils.unmarshal_json(
617
- http_res.text, errors.UnauthenticatedErrorData
561
+ response_data = utils.unmarshal_json_response(
562
+ errors.UnauthenticatedErrorData, http_res
618
563
  )
619
- raise errors.UnauthenticatedError(data=response_data)
564
+ raise errors.UnauthenticatedError(response_data, http_res)
620
565
  if utils.match_response(http_res, "404", "application/json"):
621
- response_data = utils.unmarshal_json(
622
- http_res.text, errors.ResourceNotFoundErrorData
566
+ response_data = utils.unmarshal_json_response(
567
+ errors.ResourceNotFoundErrorData, http_res
623
568
  )
624
- raise errors.ResourceNotFoundError(data=response_data)
569
+ raise errors.ResourceNotFoundError(response_data, http_res)
625
570
  if utils.match_response(http_res, "429", "application/json"):
626
- response_data = utils.unmarshal_json(
627
- http_res.text, errors.TooManyRequestsErrorData
571
+ response_data = utils.unmarshal_json_response(
572
+ errors.TooManyRequestsErrorData, http_res
628
573
  )
629
- raise errors.TooManyRequestsError(data=response_data)
574
+ raise errors.TooManyRequestsError(response_data, http_res)
630
575
  if utils.match_response(http_res, "500", "application/json"):
631
- response_data = utils.unmarshal_json(
632
- http_res.text, errors.InternalServerErrorData
576
+ response_data = utils.unmarshal_json_response(
577
+ errors.InternalServerErrorData, http_res
633
578
  )
634
- raise errors.InternalServerError(data=response_data)
579
+ raise errors.InternalServerError(response_data, http_res)
635
580
  if utils.match_response(http_res, "4XX", "*"):
636
581
  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
- )
582
+ raise errors.APIError("API error occurred", http_res, http_res_text)
640
583
  if utils.match_response(http_res, "5XX", "*"):
641
584
  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
- )
585
+ raise errors.APIError("API error occurred", http_res, http_res_text)
645
586
 
646
- content_type = http_res.headers.get("Content-Type")
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
- )
587
+ raise errors.APIError("Unexpected response received", http_res)
654
588
 
655
- async def bulk_upsert_async(
589
+ async def bulk_upsert_docs_async(
656
590
  self,
657
591
  *,
658
- project_name: str,
659
592
  collection_name: str,
660
593
  object_key: str,
661
594
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -665,7 +598,6 @@ class Docs(BaseSDK):
665
598
  ) -> models.MessageResponse:
666
599
  r"""Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
667
600
 
668
- :param project_name: Project name.
669
601
  :param collection_name: Collection name.
670
602
  :param object_key: Object key uploaded based on bulk upsert info.
671
603
  :param retries: Override the default retry configuration for this method
@@ -684,7 +616,6 @@ class Docs(BaseSDK):
684
616
  base_url = self._get_url(base_url, url_variables)
685
617
 
686
618
  request = models.BulkUpsertDocsRequest(
687
- project_name=project_name,
688
619
  collection_name=collection_name,
689
620
  request_body=models.BulkUpsertDocsRequestBody(
690
621
  object_key=object_key,
@@ -693,7 +624,7 @@ class Docs(BaseSDK):
693
624
 
694
625
  req = self._build_request_async(
695
626
  method="POST",
696
- path="/projects/{projectName}/collections/{collectionName}/docs/bulk-upsert",
627
+ path="/collections/{collectionName}/docs/bulk-upsert",
697
628
  base_url=base_url,
698
629
  url_variables=url_variables,
699
630
  request=request,
@@ -743,58 +674,46 @@ class Docs(BaseSDK):
743
674
 
744
675
  response_data: Any = None
745
676
  if utils.match_response(http_res, "202", "application/json"):
746
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
677
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
747
678
  if utils.match_response(http_res, "400", "application/json"):
748
- response_data = utils.unmarshal_json(
749
- http_res.text, errors.BadRequestErrorData
679
+ response_data = utils.unmarshal_json_response(
680
+ errors.BadRequestErrorData, http_res
750
681
  )
751
- raise errors.BadRequestError(data=response_data)
682
+ raise errors.BadRequestError(response_data, http_res)
752
683
  if utils.match_response(http_res, "401", "application/json"):
753
- response_data = utils.unmarshal_json(
754
- http_res.text, errors.UnauthenticatedErrorData
684
+ response_data = utils.unmarshal_json_response(
685
+ errors.UnauthenticatedErrorData, http_res
755
686
  )
756
- raise errors.UnauthenticatedError(data=response_data)
687
+ raise errors.UnauthenticatedError(response_data, http_res)
757
688
  if utils.match_response(http_res, "404", "application/json"):
758
- response_data = utils.unmarshal_json(
759
- http_res.text, errors.ResourceNotFoundErrorData
689
+ response_data = utils.unmarshal_json_response(
690
+ errors.ResourceNotFoundErrorData, http_res
760
691
  )
761
- raise errors.ResourceNotFoundError(data=response_data)
692
+ raise errors.ResourceNotFoundError(response_data, http_res)
762
693
  if utils.match_response(http_res, "429", "application/json"):
763
- response_data = utils.unmarshal_json(
764
- http_res.text, errors.TooManyRequestsErrorData
694
+ response_data = utils.unmarshal_json_response(
695
+ errors.TooManyRequestsErrorData, http_res
765
696
  )
766
- raise errors.TooManyRequestsError(data=response_data)
697
+ raise errors.TooManyRequestsError(response_data, http_res)
767
698
  if utils.match_response(http_res, "500", "application/json"):
768
- response_data = utils.unmarshal_json(
769
- http_res.text, errors.InternalServerErrorData
699
+ response_data = utils.unmarshal_json_response(
700
+ errors.InternalServerErrorData, http_res
770
701
  )
771
- raise errors.InternalServerError(data=response_data)
702
+ raise errors.InternalServerError(response_data, http_res)
772
703
  if utils.match_response(http_res, "4XX", "*"):
773
704
  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
- )
705
+ raise errors.APIError("API error occurred", http_res, http_res_text)
777
706
  if utils.match_response(http_res, "5XX", "*"):
778
707
  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
- )
708
+ raise errors.APIError("API error occurred", http_res, http_res_text)
782
709
 
783
- content_type = http_res.headers.get("Content-Type")
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
- )
710
+ raise errors.APIError("Unexpected response received", http_res)
791
711
 
792
712
  def update_docs(
793
713
  self,
794
714
  *,
795
- project_name: str,
796
715
  collection_name: str,
797
- docs: Union[List[models.UpdateDocsDoc], List[models.UpdateDocsDocTypedDict]],
716
+ docs: List[Dict[str, Any]],
798
717
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
799
718
  server_url: Optional[str] = None,
800
719
  timeout_ms: Optional[int] = None,
@@ -802,7 +721,6 @@ class Docs(BaseSDK):
802
721
  ) -> models.MessageResponse:
803
722
  r"""Update documents in a collection. Note that the maximum supported payload size is 6MB.
804
723
 
805
- :param project_name: Project name.
806
724
  :param collection_name: Collection name.
807
725
  :param docs: A list of documents to update. Each document must contain 'id' field to be updated.
808
726
  :param retries: Override the default retry configuration for this method
@@ -821,16 +739,15 @@ class Docs(BaseSDK):
821
739
  base_url = self._get_url(base_url, url_variables)
822
740
 
823
741
  request = models.UpdateDocsRequest(
824
- project_name=project_name,
825
742
  collection_name=collection_name,
826
743
  request_body=models.UpdateDocsRequestBody(
827
- docs=utils.get_pydantic_model(docs, List[models.UpdateDocsDoc]),
744
+ docs=docs,
828
745
  ),
829
746
  )
830
747
 
831
748
  req = self._build_request(
832
749
  method="POST",
833
- path="/projects/{projectName}/collections/{collectionName}/docs/update",
750
+ path="/collections/{collectionName}/docs/update",
834
751
  base_url=base_url,
835
752
  url_variables=url_variables,
836
753
  request=request,
@@ -876,58 +793,46 @@ class Docs(BaseSDK):
876
793
 
877
794
  response_data: Any = None
878
795
  if utils.match_response(http_res, "202", "application/json"):
879
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
796
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
880
797
  if utils.match_response(http_res, "400", "application/json"):
881
- response_data = utils.unmarshal_json(
882
- http_res.text, errors.BadRequestErrorData
798
+ response_data = utils.unmarshal_json_response(
799
+ errors.BadRequestErrorData, http_res
883
800
  )
884
- raise errors.BadRequestError(data=response_data)
801
+ raise errors.BadRequestError(response_data, http_res)
885
802
  if utils.match_response(http_res, "401", "application/json"):
886
- response_data = utils.unmarshal_json(
887
- http_res.text, errors.UnauthenticatedErrorData
803
+ response_data = utils.unmarshal_json_response(
804
+ errors.UnauthenticatedErrorData, http_res
888
805
  )
889
- raise errors.UnauthenticatedError(data=response_data)
806
+ raise errors.UnauthenticatedError(response_data, http_res)
890
807
  if utils.match_response(http_res, "404", "application/json"):
891
- response_data = utils.unmarshal_json(
892
- http_res.text, errors.ResourceNotFoundErrorData
808
+ response_data = utils.unmarshal_json_response(
809
+ errors.ResourceNotFoundErrorData, http_res
893
810
  )
894
- raise errors.ResourceNotFoundError(data=response_data)
811
+ raise errors.ResourceNotFoundError(response_data, http_res)
895
812
  if utils.match_response(http_res, "429", "application/json"):
896
- response_data = utils.unmarshal_json(
897
- http_res.text, errors.TooManyRequestsErrorData
813
+ response_data = utils.unmarshal_json_response(
814
+ errors.TooManyRequestsErrorData, http_res
898
815
  )
899
- raise errors.TooManyRequestsError(data=response_data)
816
+ raise errors.TooManyRequestsError(response_data, http_res)
900
817
  if utils.match_response(http_res, "500", "application/json"):
901
- response_data = utils.unmarshal_json(
902
- http_res.text, errors.InternalServerErrorData
818
+ response_data = utils.unmarshal_json_response(
819
+ errors.InternalServerErrorData, http_res
903
820
  )
904
- raise errors.InternalServerError(data=response_data)
821
+ raise errors.InternalServerError(response_data, http_res)
905
822
  if utils.match_response(http_res, "4XX", "*"):
906
823
  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
- )
824
+ raise errors.APIError("API error occurred", http_res, http_res_text)
910
825
  if utils.match_response(http_res, "5XX", "*"):
911
826
  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
- )
827
+ raise errors.APIError("API error occurred", http_res, http_res_text)
915
828
 
916
- content_type = http_res.headers.get("Content-Type")
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
- )
829
+ raise errors.APIError("Unexpected response received", http_res)
924
830
 
925
831
  async def update_docs_async(
926
832
  self,
927
833
  *,
928
- project_name: str,
929
834
  collection_name: str,
930
- docs: Union[List[models.UpdateDocsDoc], List[models.UpdateDocsDocTypedDict]],
835
+ docs: List[Dict[str, Any]],
931
836
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
932
837
  server_url: Optional[str] = None,
933
838
  timeout_ms: Optional[int] = None,
@@ -935,7 +840,6 @@ class Docs(BaseSDK):
935
840
  ) -> models.MessageResponse:
936
841
  r"""Update documents in a collection. Note that the maximum supported payload size is 6MB.
937
842
 
938
- :param project_name: Project name.
939
843
  :param collection_name: Collection name.
940
844
  :param docs: A list of documents to update. Each document must contain 'id' field to be updated.
941
845
  :param retries: Override the default retry configuration for this method
@@ -954,16 +858,15 @@ class Docs(BaseSDK):
954
858
  base_url = self._get_url(base_url, url_variables)
955
859
 
956
860
  request = models.UpdateDocsRequest(
957
- project_name=project_name,
958
861
  collection_name=collection_name,
959
862
  request_body=models.UpdateDocsRequestBody(
960
- docs=utils.get_pydantic_model(docs, List[models.UpdateDocsDoc]),
863
+ docs=docs,
961
864
  ),
962
865
  )
963
866
 
964
867
  req = self._build_request_async(
965
868
  method="POST",
966
- path="/projects/{projectName}/collections/{collectionName}/docs/update",
869
+ path="/collections/{collectionName}/docs/update",
967
870
  base_url=base_url,
968
871
  url_variables=url_variables,
969
872
  request=request,
@@ -1009,59 +912,47 @@ class Docs(BaseSDK):
1009
912
 
1010
913
  response_data: Any = None
1011
914
  if utils.match_response(http_res, "202", "application/json"):
1012
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
915
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
1013
916
  if utils.match_response(http_res, "400", "application/json"):
1014
- response_data = utils.unmarshal_json(
1015
- http_res.text, errors.BadRequestErrorData
917
+ response_data = utils.unmarshal_json_response(
918
+ errors.BadRequestErrorData, http_res
1016
919
  )
1017
- raise errors.BadRequestError(data=response_data)
920
+ raise errors.BadRequestError(response_data, http_res)
1018
921
  if utils.match_response(http_res, "401", "application/json"):
1019
- response_data = utils.unmarshal_json(
1020
- http_res.text, errors.UnauthenticatedErrorData
922
+ response_data = utils.unmarshal_json_response(
923
+ errors.UnauthenticatedErrorData, http_res
1021
924
  )
1022
- raise errors.UnauthenticatedError(data=response_data)
925
+ raise errors.UnauthenticatedError(response_data, http_res)
1023
926
  if utils.match_response(http_res, "404", "application/json"):
1024
- response_data = utils.unmarshal_json(
1025
- http_res.text, errors.ResourceNotFoundErrorData
927
+ response_data = utils.unmarshal_json_response(
928
+ errors.ResourceNotFoundErrorData, http_res
1026
929
  )
1027
- raise errors.ResourceNotFoundError(data=response_data)
930
+ raise errors.ResourceNotFoundError(response_data, http_res)
1028
931
  if utils.match_response(http_res, "429", "application/json"):
1029
- response_data = utils.unmarshal_json(
1030
- http_res.text, errors.TooManyRequestsErrorData
932
+ response_data = utils.unmarshal_json_response(
933
+ errors.TooManyRequestsErrorData, http_res
1031
934
  )
1032
- raise errors.TooManyRequestsError(data=response_data)
935
+ raise errors.TooManyRequestsError(response_data, http_res)
1033
936
  if utils.match_response(http_res, "500", "application/json"):
1034
- response_data = utils.unmarshal_json(
1035
- http_res.text, errors.InternalServerErrorData
937
+ response_data = utils.unmarshal_json_response(
938
+ errors.InternalServerErrorData, http_res
1036
939
  )
1037
- raise errors.InternalServerError(data=response_data)
940
+ raise errors.InternalServerError(response_data, http_res)
1038
941
  if utils.match_response(http_res, "4XX", "*"):
1039
942
  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
- )
943
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1043
944
  if utils.match_response(http_res, "5XX", "*"):
1044
945
  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
- )
946
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1048
947
 
1049
- content_type = http_res.headers.get("Content-Type")
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
- )
948
+ raise errors.APIError("Unexpected response received", http_res)
1057
949
 
1058
- def delete(
950
+ def delete_docs(
1059
951
  self,
1060
952
  *,
1061
- project_name: str,
1062
953
  collection_name: str,
1063
954
  ids: Optional[List[str]] = None,
1064
- filter_: Optional[Union[models.Filter, models.FilterTypedDict]] = None,
955
+ filter_: Optional[Dict[str, Any]] = None,
1065
956
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1066
957
  server_url: Optional[str] = None,
1067
958
  timeout_ms: Optional[int] = None,
@@ -1069,7 +960,6 @@ class Docs(BaseSDK):
1069
960
  ) -> models.MessageResponse:
1070
961
  r"""Delete documents by document IDs or query filter from a collection.
1071
962
 
1072
- :param project_name: Project name.
1073
963
  :param collection_name: Collection name.
1074
964
  :param ids: A list of document IDs.
1075
965
  :param filter_: Query filter.
@@ -1089,17 +979,16 @@ class Docs(BaseSDK):
1089
979
  base_url = self._get_url(base_url, url_variables)
1090
980
 
1091
981
  request = models.DeleteDocsRequest(
1092
- project_name=project_name,
1093
982
  collection_name=collection_name,
1094
983
  request_body=models.DeleteDocsRequestBody(
1095
984
  ids=ids,
1096
- filter_=utils.get_pydantic_model(filter_, Optional[models.Filter]),
985
+ filter_=filter_,
1097
986
  ),
1098
987
  )
1099
988
 
1100
989
  req = self._build_request(
1101
990
  method="POST",
1102
- path="/projects/{projectName}/collections/{collectionName}/docs/delete",
991
+ path="/collections/{collectionName}/docs/delete",
1103
992
  base_url=base_url,
1104
993
  url_variables=url_variables,
1105
994
  request=request,
@@ -1145,59 +1034,47 @@ class Docs(BaseSDK):
1145
1034
 
1146
1035
  response_data: Any = None
1147
1036
  if utils.match_response(http_res, "202", "application/json"):
1148
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
1037
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
1149
1038
  if utils.match_response(http_res, "400", "application/json"):
1150
- response_data = utils.unmarshal_json(
1151
- http_res.text, errors.BadRequestErrorData
1039
+ response_data = utils.unmarshal_json_response(
1040
+ errors.BadRequestErrorData, http_res
1152
1041
  )
1153
- raise errors.BadRequestError(data=response_data)
1042
+ raise errors.BadRequestError(response_data, http_res)
1154
1043
  if utils.match_response(http_res, "401", "application/json"):
1155
- response_data = utils.unmarshal_json(
1156
- http_res.text, errors.UnauthenticatedErrorData
1044
+ response_data = utils.unmarshal_json_response(
1045
+ errors.UnauthenticatedErrorData, http_res
1157
1046
  )
1158
- raise errors.UnauthenticatedError(data=response_data)
1047
+ raise errors.UnauthenticatedError(response_data, http_res)
1159
1048
  if utils.match_response(http_res, "404", "application/json"):
1160
- response_data = utils.unmarshal_json(
1161
- http_res.text, errors.ResourceNotFoundErrorData
1049
+ response_data = utils.unmarshal_json_response(
1050
+ errors.ResourceNotFoundErrorData, http_res
1162
1051
  )
1163
- raise errors.ResourceNotFoundError(data=response_data)
1052
+ raise errors.ResourceNotFoundError(response_data, http_res)
1164
1053
  if utils.match_response(http_res, "429", "application/json"):
1165
- response_data = utils.unmarshal_json(
1166
- http_res.text, errors.TooManyRequestsErrorData
1054
+ response_data = utils.unmarshal_json_response(
1055
+ errors.TooManyRequestsErrorData, http_res
1167
1056
  )
1168
- raise errors.TooManyRequestsError(data=response_data)
1057
+ raise errors.TooManyRequestsError(response_data, http_res)
1169
1058
  if utils.match_response(http_res, "500", "application/json"):
1170
- response_data = utils.unmarshal_json(
1171
- http_res.text, errors.InternalServerErrorData
1059
+ response_data = utils.unmarshal_json_response(
1060
+ errors.InternalServerErrorData, http_res
1172
1061
  )
1173
- raise errors.InternalServerError(data=response_data)
1062
+ raise errors.InternalServerError(response_data, http_res)
1174
1063
  if utils.match_response(http_res, "4XX", "*"):
1175
1064
  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
- )
1065
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1179
1066
  if utils.match_response(http_res, "5XX", "*"):
1180
1067
  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
- )
1068
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1184
1069
 
1185
- content_type = http_res.headers.get("Content-Type")
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
- )
1070
+ raise errors.APIError("Unexpected response received", http_res)
1193
1071
 
1194
- async def delete_async(
1072
+ async def delete_docs_async(
1195
1073
  self,
1196
1074
  *,
1197
- project_name: str,
1198
1075
  collection_name: str,
1199
1076
  ids: Optional[List[str]] = None,
1200
- filter_: Optional[Union[models.Filter, models.FilterTypedDict]] = None,
1077
+ filter_: Optional[Dict[str, Any]] = None,
1201
1078
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
1202
1079
  server_url: Optional[str] = None,
1203
1080
  timeout_ms: Optional[int] = None,
@@ -1205,7 +1082,6 @@ class Docs(BaseSDK):
1205
1082
  ) -> models.MessageResponse:
1206
1083
  r"""Delete documents by document IDs or query filter from a collection.
1207
1084
 
1208
- :param project_name: Project name.
1209
1085
  :param collection_name: Collection name.
1210
1086
  :param ids: A list of document IDs.
1211
1087
  :param filter_: Query filter.
@@ -1225,17 +1101,16 @@ class Docs(BaseSDK):
1225
1101
  base_url = self._get_url(base_url, url_variables)
1226
1102
 
1227
1103
  request = models.DeleteDocsRequest(
1228
- project_name=project_name,
1229
1104
  collection_name=collection_name,
1230
1105
  request_body=models.DeleteDocsRequestBody(
1231
1106
  ids=ids,
1232
- filter_=utils.get_pydantic_model(filter_, Optional[models.Filter]),
1107
+ filter_=filter_,
1233
1108
  ),
1234
1109
  )
1235
1110
 
1236
1111
  req = self._build_request_async(
1237
1112
  method="POST",
1238
- path="/projects/{projectName}/collections/{collectionName}/docs/delete",
1113
+ path="/collections/{collectionName}/docs/delete",
1239
1114
  base_url=base_url,
1240
1115
  url_variables=url_variables,
1241
1116
  request=request,
@@ -1281,56 +1156,44 @@ class Docs(BaseSDK):
1281
1156
 
1282
1157
  response_data: Any = None
1283
1158
  if utils.match_response(http_res, "202", "application/json"):
1284
- return utils.unmarshal_json(http_res.text, models.MessageResponse)
1159
+ return utils.unmarshal_json_response(models.MessageResponse, http_res)
1285
1160
  if utils.match_response(http_res, "400", "application/json"):
1286
- response_data = utils.unmarshal_json(
1287
- http_res.text, errors.BadRequestErrorData
1161
+ response_data = utils.unmarshal_json_response(
1162
+ errors.BadRequestErrorData, http_res
1288
1163
  )
1289
- raise errors.BadRequestError(data=response_data)
1164
+ raise errors.BadRequestError(response_data, http_res)
1290
1165
  if utils.match_response(http_res, "401", "application/json"):
1291
- response_data = utils.unmarshal_json(
1292
- http_res.text, errors.UnauthenticatedErrorData
1166
+ response_data = utils.unmarshal_json_response(
1167
+ errors.UnauthenticatedErrorData, http_res
1293
1168
  )
1294
- raise errors.UnauthenticatedError(data=response_data)
1169
+ raise errors.UnauthenticatedError(response_data, http_res)
1295
1170
  if utils.match_response(http_res, "404", "application/json"):
1296
- response_data = utils.unmarshal_json(
1297
- http_res.text, errors.ResourceNotFoundErrorData
1171
+ response_data = utils.unmarshal_json_response(
1172
+ errors.ResourceNotFoundErrorData, http_res
1298
1173
  )
1299
- raise errors.ResourceNotFoundError(data=response_data)
1174
+ raise errors.ResourceNotFoundError(response_data, http_res)
1300
1175
  if utils.match_response(http_res, "429", "application/json"):
1301
- response_data = utils.unmarshal_json(
1302
- http_res.text, errors.TooManyRequestsErrorData
1176
+ response_data = utils.unmarshal_json_response(
1177
+ errors.TooManyRequestsErrorData, http_res
1303
1178
  )
1304
- raise errors.TooManyRequestsError(data=response_data)
1179
+ raise errors.TooManyRequestsError(response_data, http_res)
1305
1180
  if utils.match_response(http_res, "500", "application/json"):
1306
- response_data = utils.unmarshal_json(
1307
- http_res.text, errors.InternalServerErrorData
1181
+ response_data = utils.unmarshal_json_response(
1182
+ errors.InternalServerErrorData, http_res
1308
1183
  )
1309
- raise errors.InternalServerError(data=response_data)
1184
+ raise errors.InternalServerError(response_data, http_res)
1310
1185
  if utils.match_response(http_res, "4XX", "*"):
1311
1186
  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
- )
1187
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1315
1188
  if utils.match_response(http_res, "5XX", "*"):
1316
1189
  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
- )
1190
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1320
1191
 
1321
- content_type = http_res.headers.get("Content-Type")
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
- )
1192
+ raise errors.APIError("Unexpected response received", http_res)
1329
1193
 
1330
- def fetch(
1194
+ def fetch_docs(
1331
1195
  self,
1332
1196
  *,
1333
- project_name: str,
1334
1197
  collection_name: str,
1335
1198
  ids: List[str],
1336
1199
  consistent_read: Optional[bool] = False,
@@ -1342,7 +1205,6 @@ class Docs(BaseSDK):
1342
1205
  ) -> models.FetchDocsResponse:
1343
1206
  r"""Lookup and return documents by document IDs from a collection.
1344
1207
 
1345
- :param project_name: Project name.
1346
1208
  :param collection_name: Collection name.
1347
1209
  :param ids: A list of document IDs to fetch. Note that the maximum number of document IDs is 100.
1348
1210
  :param consistent_read: If your application requires a strongly consistent read, set consistentRead to true. Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.
@@ -1363,7 +1225,6 @@ class Docs(BaseSDK):
1363
1225
  base_url = self._get_url(base_url, url_variables)
1364
1226
 
1365
1227
  request = models.FetchDocsRequest(
1366
- project_name=project_name,
1367
1228
  collection_name=collection_name,
1368
1229
  request_body=models.FetchDocsRequestBody(
1369
1230
  ids=ids,
@@ -1374,7 +1235,7 @@ class Docs(BaseSDK):
1374
1235
 
1375
1236
  req = self._build_request(
1376
1237
  method="POST",
1377
- path="/projects/{projectName}/collections/{collectionName}/docs/fetch",
1238
+ path="/collections/{collectionName}/docs/fetch",
1378
1239
  base_url=base_url,
1379
1240
  url_variables=url_variables,
1380
1241
  request=request,
@@ -1420,56 +1281,44 @@ class Docs(BaseSDK):
1420
1281
 
1421
1282
  response_data: Any = None
1422
1283
  if utils.match_response(http_res, "200", "application/json"):
1423
- return utils.unmarshal_json(http_res.text, models.FetchDocsResponse)
1284
+ return utils.unmarshal_json_response(models.FetchDocsResponse, http_res)
1424
1285
  if utils.match_response(http_res, "400", "application/json"):
1425
- response_data = utils.unmarshal_json(
1426
- http_res.text, errors.BadRequestErrorData
1286
+ response_data = utils.unmarshal_json_response(
1287
+ errors.BadRequestErrorData, http_res
1427
1288
  )
1428
- raise errors.BadRequestError(data=response_data)
1289
+ raise errors.BadRequestError(response_data, http_res)
1429
1290
  if utils.match_response(http_res, "401", "application/json"):
1430
- response_data = utils.unmarshal_json(
1431
- http_res.text, errors.UnauthenticatedErrorData
1291
+ response_data = utils.unmarshal_json_response(
1292
+ errors.UnauthenticatedErrorData, http_res
1432
1293
  )
1433
- raise errors.UnauthenticatedError(data=response_data)
1294
+ raise errors.UnauthenticatedError(response_data, http_res)
1434
1295
  if utils.match_response(http_res, "404", "application/json"):
1435
- response_data = utils.unmarshal_json(
1436
- http_res.text, errors.ResourceNotFoundErrorData
1296
+ response_data = utils.unmarshal_json_response(
1297
+ errors.ResourceNotFoundErrorData, http_res
1437
1298
  )
1438
- raise errors.ResourceNotFoundError(data=response_data)
1299
+ raise errors.ResourceNotFoundError(response_data, http_res)
1439
1300
  if utils.match_response(http_res, "429", "application/json"):
1440
- response_data = utils.unmarshal_json(
1441
- http_res.text, errors.TooManyRequestsErrorData
1301
+ response_data = utils.unmarshal_json_response(
1302
+ errors.TooManyRequestsErrorData, http_res
1442
1303
  )
1443
- raise errors.TooManyRequestsError(data=response_data)
1304
+ raise errors.TooManyRequestsError(response_data, http_res)
1444
1305
  if utils.match_response(http_res, "500", "application/json"):
1445
- response_data = utils.unmarshal_json(
1446
- http_res.text, errors.InternalServerErrorData
1306
+ response_data = utils.unmarshal_json_response(
1307
+ errors.InternalServerErrorData, http_res
1447
1308
  )
1448
- raise errors.InternalServerError(data=response_data)
1309
+ raise errors.InternalServerError(response_data, http_res)
1449
1310
  if utils.match_response(http_res, "4XX", "*"):
1450
1311
  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
- )
1312
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1454
1313
  if utils.match_response(http_res, "5XX", "*"):
1455
1314
  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
- )
1315
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1459
1316
 
1460
- content_type = http_res.headers.get("Content-Type")
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
- )
1317
+ raise errors.APIError("Unexpected response received", http_res)
1468
1318
 
1469
- async def fetch_async(
1319
+ async def fetch_docs_async(
1470
1320
  self,
1471
1321
  *,
1472
- project_name: str,
1473
1322
  collection_name: str,
1474
1323
  ids: List[str],
1475
1324
  consistent_read: Optional[bool] = False,
@@ -1481,7 +1330,6 @@ class Docs(BaseSDK):
1481
1330
  ) -> models.FetchDocsResponse:
1482
1331
  r"""Lookup and return documents by document IDs from a collection.
1483
1332
 
1484
- :param project_name: Project name.
1485
1333
  :param collection_name: Collection name.
1486
1334
  :param ids: A list of document IDs to fetch. Note that the maximum number of document IDs is 100.
1487
1335
  :param consistent_read: If your application requires a strongly consistent read, set consistentRead to true. Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.
@@ -1502,7 +1350,6 @@ class Docs(BaseSDK):
1502
1350
  base_url = self._get_url(base_url, url_variables)
1503
1351
 
1504
1352
  request = models.FetchDocsRequest(
1505
- project_name=project_name,
1506
1353
  collection_name=collection_name,
1507
1354
  request_body=models.FetchDocsRequestBody(
1508
1355
  ids=ids,
@@ -1513,7 +1360,7 @@ class Docs(BaseSDK):
1513
1360
 
1514
1361
  req = self._build_request_async(
1515
1362
  method="POST",
1516
- path="/projects/{projectName}/collections/{collectionName}/docs/fetch",
1363
+ path="/collections/{collectionName}/docs/fetch",
1517
1364
  base_url=base_url,
1518
1365
  url_variables=url_variables,
1519
1366
  request=request,
@@ -1559,48 +1406,37 @@ class Docs(BaseSDK):
1559
1406
 
1560
1407
  response_data: Any = None
1561
1408
  if utils.match_response(http_res, "200", "application/json"):
1562
- return utils.unmarshal_json(http_res.text, models.FetchDocsResponse)
1409
+ return utils.unmarshal_json_response(models.FetchDocsResponse, http_res)
1563
1410
  if utils.match_response(http_res, "400", "application/json"):
1564
- response_data = utils.unmarshal_json(
1565
- http_res.text, errors.BadRequestErrorData
1411
+ response_data = utils.unmarshal_json_response(
1412
+ errors.BadRequestErrorData, http_res
1566
1413
  )
1567
- raise errors.BadRequestError(data=response_data)
1414
+ raise errors.BadRequestError(response_data, http_res)
1568
1415
  if utils.match_response(http_res, "401", "application/json"):
1569
- response_data = utils.unmarshal_json(
1570
- http_res.text, errors.UnauthenticatedErrorData
1416
+ response_data = utils.unmarshal_json_response(
1417
+ errors.UnauthenticatedErrorData, http_res
1571
1418
  )
1572
- raise errors.UnauthenticatedError(data=response_data)
1419
+ raise errors.UnauthenticatedError(response_data, http_res)
1573
1420
  if utils.match_response(http_res, "404", "application/json"):
1574
- response_data = utils.unmarshal_json(
1575
- http_res.text, errors.ResourceNotFoundErrorData
1421
+ response_data = utils.unmarshal_json_response(
1422
+ errors.ResourceNotFoundErrorData, http_res
1576
1423
  )
1577
- raise errors.ResourceNotFoundError(data=response_data)
1424
+ raise errors.ResourceNotFoundError(response_data, http_res)
1578
1425
  if utils.match_response(http_res, "429", "application/json"):
1579
- response_data = utils.unmarshal_json(
1580
- http_res.text, errors.TooManyRequestsErrorData
1426
+ response_data = utils.unmarshal_json_response(
1427
+ errors.TooManyRequestsErrorData, http_res
1581
1428
  )
1582
- raise errors.TooManyRequestsError(data=response_data)
1429
+ raise errors.TooManyRequestsError(response_data, http_res)
1583
1430
  if utils.match_response(http_res, "500", "application/json"):
1584
- response_data = utils.unmarshal_json(
1585
- http_res.text, errors.InternalServerErrorData
1431
+ response_data = utils.unmarshal_json_response(
1432
+ errors.InternalServerErrorData, http_res
1586
1433
  )
1587
- raise errors.InternalServerError(data=response_data)
1434
+ raise errors.InternalServerError(response_data, http_res)
1588
1435
  if utils.match_response(http_res, "4XX", "*"):
1589
1436
  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
- )
1437
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1593
1438
  if utils.match_response(http_res, "5XX", "*"):
1594
1439
  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
- )
1440
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1598
1441
 
1599
- content_type = http_res.headers.get("Content-Type")
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
- )
1442
+ raise errors.APIError("Unexpected response received", http_res)