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.
- lambdadb/_version.py +3 -3
- lambdadb/basesdk.py +4 -4
- lambdadb/collections.py +280 -452
- lambdadb/docs.py +261 -425
- 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 -54
- lambdadb/models/bulkupsertdocsop.py +0 -9
- lambdadb/models/createcollectionop.py +2 -23
- lambdadb/models/deletecollectionop.py +0 -9
- lambdadb/models/deletedocsop.py +3 -20
- lambdadb/models/fetchdocsop.py +3 -20
- lambdadb/models/getbulkupsertdocsop.py +0 -9
- lambdadb/models/getcollectionop.py +0 -9
- lambdadb/models/listcollectionsop.py +1 -17
- lambdadb/models/querycollectionop.py +7 -40
- lambdadb/models/updatecollectionop.py +0 -9
- lambdadb/models/updatedocsop.py +3 -20
- lambdadb/models/upsertdocsop.py +3 -20
- lambdadb/sdk.py +9 -1
- lambdadb/sdkconfiguration.py +4 -3
- lambdadb/utils/__init__.py +3 -0
- lambdadb/utils/serializers.py +21 -3
- {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/METADATA +94 -55
- lambdadb-0.4.0.dist-info/RECORD +64 -0
- lambdadb-0.3.5.dist-info/RECORD +0 -61
- {lambdadb-0.3.5.dist-info → lambdadb-0.4.0.dist-info}/LICENSE +0 -0
- {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
|
|
8
|
+
from typing import Any, Dict, List, Mapping, Optional
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Docs(BaseSDK):
|
|
12
|
-
def
|
|
12
|
+
def upsert_docs(
|
|
13
13
|
self,
|
|
14
14
|
*,
|
|
15
|
-
project_name: str,
|
|
16
15
|
collection_name: str,
|
|
17
|
-
docs:
|
|
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=
|
|
44
|
+
docs=docs,
|
|
48
45
|
),
|
|
49
46
|
)
|
|
50
47
|
|
|
51
48
|
req = self._build_request(
|
|
52
49
|
method="POST",
|
|
53
|
-
path="/
|
|
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.
|
|
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.
|
|
102
|
-
|
|
98
|
+
response_data = utils.unmarshal_json_response(
|
|
99
|
+
errors.BadRequestErrorData, http_res
|
|
103
100
|
)
|
|
104
|
-
raise errors.BadRequestError(
|
|
101
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
105
102
|
if utils.match_response(http_res, "401", "application/json"):
|
|
106
|
-
response_data = utils.
|
|
107
|
-
|
|
103
|
+
response_data = utils.unmarshal_json_response(
|
|
104
|
+
errors.UnauthenticatedErrorData, http_res
|
|
108
105
|
)
|
|
109
|
-
raise errors.UnauthenticatedError(
|
|
106
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
110
107
|
if utils.match_response(http_res, "404", "application/json"):
|
|
111
|
-
response_data = utils.
|
|
112
|
-
|
|
108
|
+
response_data = utils.unmarshal_json_response(
|
|
109
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
113
110
|
)
|
|
114
|
-
raise errors.ResourceNotFoundError(
|
|
111
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
115
112
|
if utils.match_response(http_res, "429", "application/json"):
|
|
116
|
-
response_data = utils.
|
|
117
|
-
|
|
113
|
+
response_data = utils.unmarshal_json_response(
|
|
114
|
+
errors.TooManyRequestsErrorData, http_res
|
|
118
115
|
)
|
|
119
|
-
raise errors.TooManyRequestsError(
|
|
116
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
120
117
|
if utils.match_response(http_res, "500", "application/json"):
|
|
121
|
-
response_data = utils.
|
|
122
|
-
|
|
118
|
+
response_data = utils.unmarshal_json_response(
|
|
119
|
+
errors.InternalServerErrorData, http_res
|
|
123
120
|
)
|
|
124
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
131
|
+
async def upsert_docs_async(
|
|
146
132
|
self,
|
|
147
133
|
*,
|
|
148
|
-
project_name: str,
|
|
149
134
|
collection_name: str,
|
|
150
|
-
docs:
|
|
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=
|
|
163
|
+
docs=docs,
|
|
181
164
|
),
|
|
182
165
|
)
|
|
183
166
|
|
|
184
167
|
req = self._build_request_async(
|
|
185
168
|
method="POST",
|
|
186
|
-
path="/
|
|
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.
|
|
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.
|
|
235
|
-
|
|
217
|
+
response_data = utils.unmarshal_json_response(
|
|
218
|
+
errors.BadRequestErrorData, http_res
|
|
236
219
|
)
|
|
237
|
-
raise errors.BadRequestError(
|
|
220
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
238
221
|
if utils.match_response(http_res, "401", "application/json"):
|
|
239
|
-
response_data = utils.
|
|
240
|
-
|
|
222
|
+
response_data = utils.unmarshal_json_response(
|
|
223
|
+
errors.UnauthenticatedErrorData, http_res
|
|
241
224
|
)
|
|
242
|
-
raise errors.UnauthenticatedError(
|
|
225
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
243
226
|
if utils.match_response(http_res, "404", "application/json"):
|
|
244
|
-
response_data = utils.
|
|
245
|
-
|
|
227
|
+
response_data = utils.unmarshal_json_response(
|
|
228
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
246
229
|
)
|
|
247
|
-
raise errors.ResourceNotFoundError(
|
|
230
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
248
231
|
if utils.match_response(http_res, "429", "application/json"):
|
|
249
|
-
response_data = utils.
|
|
250
|
-
|
|
232
|
+
response_data = utils.unmarshal_json_response(
|
|
233
|
+
errors.TooManyRequestsErrorData, http_res
|
|
251
234
|
)
|
|
252
|
-
raise errors.TooManyRequestsError(
|
|
235
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
253
236
|
if utils.match_response(http_res, "500", "application/json"):
|
|
254
|
-
response_data = utils.
|
|
255
|
-
|
|
237
|
+
response_data = utils.unmarshal_json_response(
|
|
238
|
+
errors.InternalServerErrorData, http_res
|
|
256
239
|
)
|
|
257
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
360
|
-
|
|
330
|
+
response_data = utils.unmarshal_json_response(
|
|
331
|
+
errors.UnauthenticatedErrorData, http_res
|
|
361
332
|
)
|
|
362
|
-
raise errors.UnauthenticatedError(
|
|
333
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
363
334
|
if utils.match_response(http_res, "404", "application/json"):
|
|
364
|
-
response_data = utils.
|
|
365
|
-
|
|
335
|
+
response_data = utils.unmarshal_json_response(
|
|
336
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
366
337
|
)
|
|
367
|
-
raise errors.ResourceNotFoundError(
|
|
338
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
368
339
|
if utils.match_response(http_res, "429", "application/json"):
|
|
369
|
-
response_data = utils.
|
|
370
|
-
|
|
340
|
+
response_data = utils.unmarshal_json_response(
|
|
341
|
+
errors.TooManyRequestsErrorData, http_res
|
|
371
342
|
)
|
|
372
|
-
raise errors.TooManyRequestsError(
|
|
343
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
373
344
|
if utils.match_response(http_res, "500", "application/json"):
|
|
374
|
-
response_data = utils.
|
|
375
|
-
|
|
345
|
+
response_data = utils.unmarshal_json_response(
|
|
346
|
+
errors.InternalServerErrorData, http_res
|
|
376
347
|
)
|
|
377
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
480
|
-
|
|
438
|
+
response_data = utils.unmarshal_json_response(
|
|
439
|
+
errors.UnauthenticatedErrorData, http_res
|
|
481
440
|
)
|
|
482
|
-
raise errors.UnauthenticatedError(
|
|
441
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
483
442
|
if utils.match_response(http_res, "404", "application/json"):
|
|
484
|
-
response_data = utils.
|
|
485
|
-
|
|
443
|
+
response_data = utils.unmarshal_json_response(
|
|
444
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
486
445
|
)
|
|
487
|
-
raise errors.ResourceNotFoundError(
|
|
446
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
488
447
|
if utils.match_response(http_res, "429", "application/json"):
|
|
489
|
-
response_data = utils.
|
|
490
|
-
|
|
448
|
+
response_data = utils.unmarshal_json_response(
|
|
449
|
+
errors.TooManyRequestsErrorData, http_res
|
|
491
450
|
)
|
|
492
|
-
raise errors.TooManyRequestsError(
|
|
451
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
493
452
|
if utils.match_response(http_res, "500", "application/json"):
|
|
494
|
-
response_data = utils.
|
|
495
|
-
|
|
453
|
+
response_data = utils.unmarshal_json_response(
|
|
454
|
+
errors.InternalServerErrorData, http_res
|
|
496
455
|
)
|
|
497
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
612
|
-
|
|
556
|
+
response_data = utils.unmarshal_json_response(
|
|
557
|
+
errors.BadRequestErrorData, http_res
|
|
613
558
|
)
|
|
614
|
-
raise errors.BadRequestError(
|
|
559
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
615
560
|
if utils.match_response(http_res, "401", "application/json"):
|
|
616
|
-
response_data = utils.
|
|
617
|
-
|
|
561
|
+
response_data = utils.unmarshal_json_response(
|
|
562
|
+
errors.UnauthenticatedErrorData, http_res
|
|
618
563
|
)
|
|
619
|
-
raise errors.UnauthenticatedError(
|
|
564
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
620
565
|
if utils.match_response(http_res, "404", "application/json"):
|
|
621
|
-
response_data = utils.
|
|
622
|
-
|
|
566
|
+
response_data = utils.unmarshal_json_response(
|
|
567
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
623
568
|
)
|
|
624
|
-
raise errors.ResourceNotFoundError(
|
|
569
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
625
570
|
if utils.match_response(http_res, "429", "application/json"):
|
|
626
|
-
response_data = utils.
|
|
627
|
-
|
|
571
|
+
response_data = utils.unmarshal_json_response(
|
|
572
|
+
errors.TooManyRequestsErrorData, http_res
|
|
628
573
|
)
|
|
629
|
-
raise errors.TooManyRequestsError(
|
|
574
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
630
575
|
if utils.match_response(http_res, "500", "application/json"):
|
|
631
|
-
response_data = utils.
|
|
632
|
-
|
|
576
|
+
response_data = utils.unmarshal_json_response(
|
|
577
|
+
errors.InternalServerErrorData, http_res
|
|
633
578
|
)
|
|
634
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
749
|
-
|
|
679
|
+
response_data = utils.unmarshal_json_response(
|
|
680
|
+
errors.BadRequestErrorData, http_res
|
|
750
681
|
)
|
|
751
|
-
raise errors.BadRequestError(
|
|
682
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
752
683
|
if utils.match_response(http_res, "401", "application/json"):
|
|
753
|
-
response_data = utils.
|
|
754
|
-
|
|
684
|
+
response_data = utils.unmarshal_json_response(
|
|
685
|
+
errors.UnauthenticatedErrorData, http_res
|
|
755
686
|
)
|
|
756
|
-
raise errors.UnauthenticatedError(
|
|
687
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
757
688
|
if utils.match_response(http_res, "404", "application/json"):
|
|
758
|
-
response_data = utils.
|
|
759
|
-
|
|
689
|
+
response_data = utils.unmarshal_json_response(
|
|
690
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
760
691
|
)
|
|
761
|
-
raise errors.ResourceNotFoundError(
|
|
692
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
762
693
|
if utils.match_response(http_res, "429", "application/json"):
|
|
763
|
-
response_data = utils.
|
|
764
|
-
|
|
694
|
+
response_data = utils.unmarshal_json_response(
|
|
695
|
+
errors.TooManyRequestsErrorData, http_res
|
|
765
696
|
)
|
|
766
|
-
raise errors.TooManyRequestsError(
|
|
697
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
767
698
|
if utils.match_response(http_res, "500", "application/json"):
|
|
768
|
-
response_data = utils.
|
|
769
|
-
|
|
699
|
+
response_data = utils.unmarshal_json_response(
|
|
700
|
+
errors.InternalServerErrorData, http_res
|
|
770
701
|
)
|
|
771
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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:
|
|
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=
|
|
744
|
+
docs=docs,
|
|
828
745
|
),
|
|
829
746
|
)
|
|
830
747
|
|
|
831
748
|
req = self._build_request(
|
|
832
749
|
method="POST",
|
|
833
|
-
path="/
|
|
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.
|
|
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.
|
|
882
|
-
|
|
798
|
+
response_data = utils.unmarshal_json_response(
|
|
799
|
+
errors.BadRequestErrorData, http_res
|
|
883
800
|
)
|
|
884
|
-
raise errors.BadRequestError(
|
|
801
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
885
802
|
if utils.match_response(http_res, "401", "application/json"):
|
|
886
|
-
response_data = utils.
|
|
887
|
-
|
|
803
|
+
response_data = utils.unmarshal_json_response(
|
|
804
|
+
errors.UnauthenticatedErrorData, http_res
|
|
888
805
|
)
|
|
889
|
-
raise errors.UnauthenticatedError(
|
|
806
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
890
807
|
if utils.match_response(http_res, "404", "application/json"):
|
|
891
|
-
response_data = utils.
|
|
892
|
-
|
|
808
|
+
response_data = utils.unmarshal_json_response(
|
|
809
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
893
810
|
)
|
|
894
|
-
raise errors.ResourceNotFoundError(
|
|
811
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
895
812
|
if utils.match_response(http_res, "429", "application/json"):
|
|
896
|
-
response_data = utils.
|
|
897
|
-
|
|
813
|
+
response_data = utils.unmarshal_json_response(
|
|
814
|
+
errors.TooManyRequestsErrorData, http_res
|
|
898
815
|
)
|
|
899
|
-
raise errors.TooManyRequestsError(
|
|
816
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
900
817
|
if utils.match_response(http_res, "500", "application/json"):
|
|
901
|
-
response_data = utils.
|
|
902
|
-
|
|
818
|
+
response_data = utils.unmarshal_json_response(
|
|
819
|
+
errors.InternalServerErrorData, http_res
|
|
903
820
|
)
|
|
904
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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:
|
|
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=
|
|
863
|
+
docs=docs,
|
|
961
864
|
),
|
|
962
865
|
)
|
|
963
866
|
|
|
964
867
|
req = self._build_request_async(
|
|
965
868
|
method="POST",
|
|
966
|
-
path="/
|
|
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.
|
|
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.
|
|
1015
|
-
|
|
917
|
+
response_data = utils.unmarshal_json_response(
|
|
918
|
+
errors.BadRequestErrorData, http_res
|
|
1016
919
|
)
|
|
1017
|
-
raise errors.BadRequestError(
|
|
920
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1018
921
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1019
|
-
response_data = utils.
|
|
1020
|
-
|
|
922
|
+
response_data = utils.unmarshal_json_response(
|
|
923
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1021
924
|
)
|
|
1022
|
-
raise errors.UnauthenticatedError(
|
|
925
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1023
926
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1024
|
-
response_data = utils.
|
|
1025
|
-
|
|
927
|
+
response_data = utils.unmarshal_json_response(
|
|
928
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1026
929
|
)
|
|
1027
|
-
raise errors.ResourceNotFoundError(
|
|
930
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1028
931
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1029
|
-
response_data = utils.
|
|
1030
|
-
|
|
932
|
+
response_data = utils.unmarshal_json_response(
|
|
933
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1031
934
|
)
|
|
1032
|
-
raise errors.TooManyRequestsError(
|
|
935
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1033
936
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1034
|
-
response_data = utils.
|
|
1035
|
-
|
|
937
|
+
response_data = utils.unmarshal_json_response(
|
|
938
|
+
errors.InternalServerErrorData, http_res
|
|
1036
939
|
)
|
|
1037
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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[
|
|
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_=
|
|
985
|
+
filter_=filter_,
|
|
1097
986
|
),
|
|
1098
987
|
)
|
|
1099
988
|
|
|
1100
989
|
req = self._build_request(
|
|
1101
990
|
method="POST",
|
|
1102
|
-
path="/
|
|
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.
|
|
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.
|
|
1151
|
-
|
|
1039
|
+
response_data = utils.unmarshal_json_response(
|
|
1040
|
+
errors.BadRequestErrorData, http_res
|
|
1152
1041
|
)
|
|
1153
|
-
raise errors.BadRequestError(
|
|
1042
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1154
1043
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1155
|
-
response_data = utils.
|
|
1156
|
-
|
|
1044
|
+
response_data = utils.unmarshal_json_response(
|
|
1045
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1157
1046
|
)
|
|
1158
|
-
raise errors.UnauthenticatedError(
|
|
1047
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1159
1048
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1160
|
-
response_data = utils.
|
|
1161
|
-
|
|
1049
|
+
response_data = utils.unmarshal_json_response(
|
|
1050
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1162
1051
|
)
|
|
1163
|
-
raise errors.ResourceNotFoundError(
|
|
1052
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1164
1053
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1165
|
-
response_data = utils.
|
|
1166
|
-
|
|
1054
|
+
response_data = utils.unmarshal_json_response(
|
|
1055
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1167
1056
|
)
|
|
1168
|
-
raise errors.TooManyRequestsError(
|
|
1057
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1169
1058
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1170
|
-
response_data = utils.
|
|
1171
|
-
|
|
1059
|
+
response_data = utils.unmarshal_json_response(
|
|
1060
|
+
errors.InternalServerErrorData, http_res
|
|
1172
1061
|
)
|
|
1173
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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[
|
|
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_=
|
|
1107
|
+
filter_=filter_,
|
|
1233
1108
|
),
|
|
1234
1109
|
)
|
|
1235
1110
|
|
|
1236
1111
|
req = self._build_request_async(
|
|
1237
1112
|
method="POST",
|
|
1238
|
-
path="/
|
|
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.
|
|
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.
|
|
1287
|
-
|
|
1161
|
+
response_data = utils.unmarshal_json_response(
|
|
1162
|
+
errors.BadRequestErrorData, http_res
|
|
1288
1163
|
)
|
|
1289
|
-
raise errors.BadRequestError(
|
|
1164
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1290
1165
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1291
|
-
response_data = utils.
|
|
1292
|
-
|
|
1166
|
+
response_data = utils.unmarshal_json_response(
|
|
1167
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1293
1168
|
)
|
|
1294
|
-
raise errors.UnauthenticatedError(
|
|
1169
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1295
1170
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1296
|
-
response_data = utils.
|
|
1297
|
-
|
|
1171
|
+
response_data = utils.unmarshal_json_response(
|
|
1172
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1298
1173
|
)
|
|
1299
|
-
raise errors.ResourceNotFoundError(
|
|
1174
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1300
1175
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1301
|
-
response_data = utils.
|
|
1302
|
-
|
|
1176
|
+
response_data = utils.unmarshal_json_response(
|
|
1177
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1303
1178
|
)
|
|
1304
|
-
raise errors.TooManyRequestsError(
|
|
1179
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1305
1180
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1306
|
-
response_data = utils.
|
|
1307
|
-
|
|
1181
|
+
response_data = utils.unmarshal_json_response(
|
|
1182
|
+
errors.InternalServerErrorData, http_res
|
|
1308
1183
|
)
|
|
1309
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
1426
|
-
|
|
1286
|
+
response_data = utils.unmarshal_json_response(
|
|
1287
|
+
errors.BadRequestErrorData, http_res
|
|
1427
1288
|
)
|
|
1428
|
-
raise errors.BadRequestError(
|
|
1289
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1429
1290
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1430
|
-
response_data = utils.
|
|
1431
|
-
|
|
1291
|
+
response_data = utils.unmarshal_json_response(
|
|
1292
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1432
1293
|
)
|
|
1433
|
-
raise errors.UnauthenticatedError(
|
|
1294
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1434
1295
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1435
|
-
response_data = utils.
|
|
1436
|
-
|
|
1296
|
+
response_data = utils.unmarshal_json_response(
|
|
1297
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1437
1298
|
)
|
|
1438
|
-
raise errors.ResourceNotFoundError(
|
|
1299
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1439
1300
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1440
|
-
response_data = utils.
|
|
1441
|
-
|
|
1301
|
+
response_data = utils.unmarshal_json_response(
|
|
1302
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1442
1303
|
)
|
|
1443
|
-
raise errors.TooManyRequestsError(
|
|
1304
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1444
1305
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1445
|
-
response_data = utils.
|
|
1446
|
-
|
|
1306
|
+
response_data = utils.unmarshal_json_response(
|
|
1307
|
+
errors.InternalServerErrorData, http_res
|
|
1447
1308
|
)
|
|
1448
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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
|
|
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="/
|
|
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.
|
|
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.
|
|
1565
|
-
|
|
1411
|
+
response_data = utils.unmarshal_json_response(
|
|
1412
|
+
errors.BadRequestErrorData, http_res
|
|
1566
1413
|
)
|
|
1567
|
-
raise errors.BadRequestError(
|
|
1414
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1568
1415
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1569
|
-
response_data = utils.
|
|
1570
|
-
|
|
1416
|
+
response_data = utils.unmarshal_json_response(
|
|
1417
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1571
1418
|
)
|
|
1572
|
-
raise errors.UnauthenticatedError(
|
|
1419
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1573
1420
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1574
|
-
response_data = utils.
|
|
1575
|
-
|
|
1421
|
+
response_data = utils.unmarshal_json_response(
|
|
1422
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1576
1423
|
)
|
|
1577
|
-
raise errors.ResourceNotFoundError(
|
|
1424
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1578
1425
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1579
|
-
response_data = utils.
|
|
1580
|
-
|
|
1426
|
+
response_data = utils.unmarshal_json_response(
|
|
1427
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1581
1428
|
)
|
|
1582
|
-
raise errors.TooManyRequestsError(
|
|
1429
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1583
1430
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1584
|
-
response_data = utils.
|
|
1585
|
-
|
|
1431
|
+
response_data = utils.unmarshal_json_response(
|
|
1432
|
+
errors.InternalServerErrorData, http_res
|
|
1586
1433
|
)
|
|
1587
|
-
raise errors.InternalServerError(
|
|
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
|
-
|
|
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)
|