lambdadb 0.3.5__tar.gz → 0.4.0__tar.gz

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 (72) hide show
  1. {lambdadb-0.3.5 → lambdadb-0.4.0}/PKG-INFO +94 -55
  2. {lambdadb-0.3.5 → lambdadb-0.4.0}/README-PYPI.md +93 -54
  3. {lambdadb-0.3.5 → lambdadb-0.4.0}/pyproject.toml +1 -1
  4. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/_version.py +3 -3
  5. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/basesdk.py +4 -4
  6. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/collections.py +280 -452
  7. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/docs.py +261 -425
  8. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/errors/__init__.py +9 -0
  9. lambdadb-0.4.0/src/lambdadb/errors/apierror.py +38 -0
  10. lambdadb-0.4.0/src/lambdadb/errors/badrequest_error.py +26 -0
  11. lambdadb-0.4.0/src/lambdadb/errors/internalservererror.py +26 -0
  12. lambdadb-0.4.0/src/lambdadb/errors/lambdadberror.py +26 -0
  13. lambdadb-0.4.0/src/lambdadb/errors/no_response_error.py +13 -0
  14. lambdadb-0.4.0/src/lambdadb/errors/resourcealreadyexists_error.py +26 -0
  15. lambdadb-0.4.0/src/lambdadb/errors/resourcenotfound_error.py +26 -0
  16. lambdadb-0.4.0/src/lambdadb/errors/responsevalidationerror.py +25 -0
  17. lambdadb-0.4.0/src/lambdadb/errors/toomanyrequests_error.py +26 -0
  18. lambdadb-0.4.0/src/lambdadb/errors/unauthenticated_error.py +26 -0
  19. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/__init__.py +0 -54
  20. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/bulkupsertdocsop.py +0 -9
  21. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/createcollectionop.py +2 -23
  22. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/deletecollectionop.py +0 -9
  23. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/deletedocsop.py +3 -20
  24. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/fetchdocsop.py +3 -20
  25. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/getbulkupsertdocsop.py +0 -9
  26. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/getcollectionop.py +0 -9
  27. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/listcollectionsop.py +1 -17
  28. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/querycollectionop.py +7 -40
  29. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/updatecollectionop.py +0 -9
  30. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/updatedocsop.py +3 -20
  31. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/upsertdocsop.py +3 -20
  32. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/sdk.py +9 -1
  33. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/sdkconfiguration.py +4 -3
  34. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/__init__.py +3 -0
  35. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/serializers.py +21 -3
  36. lambdadb-0.3.5/src/lambdadb/errors/apierror.py +0 -22
  37. lambdadb-0.3.5/src/lambdadb/errors/badrequest_error.py +0 -20
  38. lambdadb-0.3.5/src/lambdadb/errors/internalservererror.py +0 -20
  39. lambdadb-0.3.5/src/lambdadb/errors/resourcealreadyexists_error.py +0 -20
  40. lambdadb-0.3.5/src/lambdadb/errors/resourcenotfound_error.py +0 -20
  41. lambdadb-0.3.5/src/lambdadb/errors/toomanyrequests_error.py +0 -20
  42. lambdadb-0.3.5/src/lambdadb/errors/unauthenticated_error.py +0 -20
  43. {lambdadb-0.3.5 → lambdadb-0.4.0}/LICENSE +0 -0
  44. {lambdadb-0.3.5 → lambdadb-0.4.0}/py.typed +0 -0
  45. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/__init__.py +0 -0
  46. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/_hooks/__init__.py +0 -0
  47. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/_hooks/registration.py +0 -0
  48. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/_hooks/sdkhooks.py +0 -0
  49. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/_hooks/types.py +0 -0
  50. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/httpclient.py +0 -0
  51. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/collectionresponse.py +0 -0
  52. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/indexconfigs_union.py +0 -0
  53. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/messageresponse.py +0 -0
  54. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/security.py +0 -0
  55. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/models/status.py +0 -0
  56. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/py.typed +0 -0
  57. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/types/__init__.py +0 -0
  58. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/types/basemodel.py +0 -0
  59. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/annotations.py +0 -0
  60. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/datetimes.py +0 -0
  61. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/enums.py +0 -0
  62. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/eventstreaming.py +0 -0
  63. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/forms.py +0 -0
  64. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/headers.py +0 -0
  65. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/logger.py +0 -0
  66. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/metadata.py +0 -0
  67. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/queryparams.py +0 -0
  68. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/requestbodies.py +0 -0
  69. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/retries.py +0 -0
  70. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/security.py +0 -0
  71. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/url.py +0 -0
  72. {lambdadb-0.3.5 → lambdadb-0.4.0}/src/lambdadb/utils/values.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lambdadb
3
- Version: 0.3.5
3
+ Version: 0.4.0
4
4
  Summary: Python Client SDK Generated by Speakeasy.
5
5
  Author: Speakeasy
6
6
  Requires-Python: >=3.9.2
@@ -135,7 +135,7 @@ with LambdaDB(
135
135
  project_api_key="<YOUR_PROJECT_API_KEY>",
136
136
  ) as lambda_db:
137
137
 
138
- res = lambda_db.collections.list(project_name="<value>")
138
+ res = lambda_db.collections.list_collections()
139
139
 
140
140
  # Handle response
141
141
  print(res)
@@ -155,7 +155,7 @@ async def main():
155
155
  project_api_key="<YOUR_PROJECT_API_KEY>",
156
156
  ) as lambda_db:
157
157
 
158
- res = await lambda_db.collections.list_async(project_name="<value>")
158
+ res = await lambda_db.collections.list_collections_async()
159
159
 
160
160
  # Handle response
161
161
  print(res)
@@ -184,7 +184,7 @@ with LambdaDB(
184
184
  project_api_key="<YOUR_PROJECT_API_KEY>",
185
185
  ) as lambda_db:
186
186
 
187
- res = lambda_db.collections.list(project_name="<value>")
187
+ res = lambda_db.collections.list_collections()
188
188
 
189
189
  # Handle response
190
190
  print(res)
@@ -200,21 +200,21 @@ with LambdaDB(
200
200
 
201
201
  ### [collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
202
202
 
203
- * [list](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list) - List all collections in an existing project.
204
- * [create](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create) - Create a collection.
205
- * [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#delete) - Delete an existing collection.
206
- * [get](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#get) - Get metadata of an existing collection.
207
- * [update](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update) - Configure a collection.
208
- * [query](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query) - Search a collection with a query and return the most similar documents.
203
+ * [list_collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list_collections) - List all collections in an existing project.
204
+ * [create_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create_collection) - Create a collection.
205
+ * [delete_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#delete_collection) - Delete an existing collection.
206
+ * [get_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#get_collection) - Get metadata of an existing collection.
207
+ * [update_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update_collection) - Configure a collection.
208
+ * [query_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query_collection) - Search a collection with a query and return the most similar documents.
209
209
 
210
210
  #### [collections.docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md)
211
211
 
212
- * [upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert) - Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
213
- * [get_bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert) - Request required info to upload documents.
214
- * [bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#bulk_upsert) - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
212
+ * [upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert_docs) - Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
213
+ * [get_bulk_upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert_docs) - Request required info to upload documents.
214
+ * [bulk_upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#bulk_upsert_docs) - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
215
215
  * [update_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#update_docs) - Update documents in a collection. Note that the maximum supported payload size is 6MB.
216
- * [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete) - Delete documents by document IDs or query filter from a collection.
217
- * [fetch](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch) - Lookup and return documents by document IDs from a collection.
216
+ * [delete_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete_docs) - Delete documents by document IDs or query filter from a collection.
217
+ * [fetch_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch_docs) - Lookup and return documents by document IDs from a collection.
218
218
 
219
219
 
220
220
  </details>
@@ -235,7 +235,7 @@ with LambdaDB(
235
235
  project_api_key="<YOUR_PROJECT_API_KEY>",
236
236
  ) as lambda_db:
237
237
 
238
- res = lambda_db.collections.list(project_name="<value>",
238
+ res = lambda_db.collections.list_collections(,
239
239
  RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
240
240
 
241
241
  # Handle response
@@ -254,7 +254,7 @@ with LambdaDB(
254
254
  project_api_key="<YOUR_PROJECT_API_KEY>",
255
255
  ) as lambda_db:
256
256
 
257
- res = lambda_db.collections.list(project_name="<value>")
257
+ res = lambda_db.collections.list_collections()
258
258
 
259
259
  # Handle response
260
260
  print(res)
@@ -265,29 +265,18 @@ with LambdaDB(
265
265
  <!-- Start Error Handling [errors] -->
266
266
  ## Error Handling
267
267
 
268
- Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
268
+ [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py) is the base class for all HTTP error responses. It has the following properties:
269
269
 
270
- By default, an API error will raise a errors.APIError exception, which has the following properties:
271
-
272
- | Property | Type | Description |
273
- |-----------------|------------------|-----------------------|
274
- | `.status_code` | *int* | The HTTP status code |
275
- | `.message` | *str* | The error message |
276
- | `.raw_response` | *httpx.Response* | The raw HTTP response |
277
- | `.body` | *str* | The response content |
278
-
279
- When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list_async` method may raise the following exceptions:
280
-
281
- | Error Type | Status Code | Content Type |
282
- | ---------------------------- | ----------- | ---------------- |
283
- | errors.UnauthenticatedError | 401 | application/json |
284
- | errors.ResourceNotFoundError | 404 | application/json |
285
- | errors.TooManyRequestsError | 429 | application/json |
286
- | errors.InternalServerError | 500 | application/json |
287
- | errors.APIError | 4XX, 5XX | \*/\* |
270
+ | Property | Type | Description |
271
+ | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
272
+ | `err.message` | `str` | Error message |
273
+ | `err.status_code` | `int` | HTTP response status code eg `404` |
274
+ | `err.headers` | `httpx.Headers` | HTTP response headers |
275
+ | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
276
+ | `err.raw_response` | `httpx.Response` | Raw HTTP response |
277
+ | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](https://github.com/lambdadb/lambdadb-python-client/blob/master/#error-classes). |
288
278
 
289
279
  ### Example
290
-
291
280
  ```python
292
281
  from lambdadb import LambdaDB, errors
293
282
 
@@ -298,32 +287,82 @@ with LambdaDB(
298
287
  res = None
299
288
  try:
300
289
 
301
- res = lambda_db.collections.list(project_name="<value>")
290
+ res = lambda_db.collections.list_collections()
302
291
 
303
292
  # Handle response
304
293
  print(res)
305
294
 
306
- except errors.UnauthenticatedError as e:
307
- # handle e.data: errors.UnauthenticatedErrorData
308
- raise(e)
309
- except errors.ResourceNotFoundError as e:
310
- # handle e.data: errors.ResourceNotFoundErrorData
311
- raise(e)
312
- except errors.TooManyRequestsError as e:
313
- # handle e.data: errors.TooManyRequestsErrorData
314
- raise(e)
315
- except errors.InternalServerError as e:
316
- # handle e.data: errors.InternalServerErrorData
317
- raise(e)
318
- except errors.APIError as e:
319
- # handle exception
320
- raise(e)
295
+
296
+ except errors.LambdaDBError as e:
297
+ # The base class for HTTP error responses
298
+ print(e.message)
299
+ print(e.status_code)
300
+ print(e.body)
301
+ print(e.headers)
302
+ print(e.raw_response)
303
+
304
+ # Depending on the method different errors may be thrown
305
+ if isinstance(e, errors.UnauthenticatedError):
306
+ print(e.data.message) # Optional[str]
321
307
  ```
308
+
309
+ ### Error Classes
310
+ **Primary errors:**
311
+ * [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py): The base class for HTTP error responses.
312
+ * [`UnauthenticatedError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/unauthenticatederror.py): Unauthenticated. Status code `401`.
313
+ * [`TooManyRequestsError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/toomanyrequestserror.py): Too many requests. Status code `429`.
314
+ * [`InternalServerError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/internalservererror.py): Internal server error. Status code `500`.
315
+ * [`ResourceNotFoundError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/resourcenotfounderror.py): Resource not found. Status code `404`. *
316
+
317
+ <details><summary>Less common errors (7)</summary>
318
+
319
+ <br />
320
+
321
+ **Network errors:**
322
+ * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
323
+ * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
324
+ * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
325
+
326
+
327
+ **Inherit from [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py)**:
328
+ * [`BadRequestError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/badrequesterror.py): Bad request. Status code `400`. Applicable to 8 of 12 methods.*
329
+ * [`ResourceAlreadyExistsError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/resourcealreadyexistserror.py): Resource already exists. Status code `409`. Applicable to 1 of 12 methods.*
330
+ * [`ResponseValidationError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
331
+
332
+ </details>
333
+
334
+ \* Check [the method documentation](https://github.com/lambdadb/lambdadb-python-client/blob/master/#available-resources-and-operations) to see if the error is applicable.
322
335
  <!-- End Error Handling [errors] -->
323
336
 
324
337
  <!-- Start Server Selection [server] -->
325
338
  ## Server Selection
326
339
 
340
+ ### Server Variables
341
+
342
+ The default server `https://{baseUrl}` contains variables and is set to `https://api.lambdadb.com/projects/default` by default. To override default values, the following parameters are available when initializing the SDK client instance:
343
+
344
+ | Variable | Parameter | Default | Description |
345
+ | --------- | --------------- | ------------------------------------- | ----------------------- |
346
+ | `baseUrl` | `base_url: str` | `"api.lambdadb.com/projects/default"` | The base URL of the API |
347
+
348
+ #### Example
349
+
350
+ ```python
351
+ from lambdadb import LambdaDB
352
+
353
+
354
+ with LambdaDB(
355
+ base_url="https://functional-jury.net/"
356
+ project_api_key="<YOUR_PROJECT_API_KEY>",
357
+ ) as lambda_db:
358
+
359
+ res = lambda_db.collections.list_collections()
360
+
361
+ # Handle response
362
+ print(res)
363
+
364
+ ```
365
+
327
366
  ### Override Server URL Per-Client
328
367
 
329
368
  The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
@@ -332,11 +371,11 @@ from lambdadb import LambdaDB
332
371
 
333
372
 
334
373
  with LambdaDB(
335
- server_url="https://{baseUrl}",
374
+ server_url="https://api.lambdadb.com/projects/default",
336
375
  project_api_key="<YOUR_PROJECT_API_KEY>",
337
376
  ) as lambda_db:
338
377
 
339
- res = lambda_db.collections.list(project_name="<value>")
378
+ res = lambda_db.collections.list_collections()
340
379
 
341
380
  # Handle response
342
381
  print(res)
@@ -118,7 +118,7 @@ with LambdaDB(
118
118
  project_api_key="<YOUR_PROJECT_API_KEY>",
119
119
  ) as lambda_db:
120
120
 
121
- res = lambda_db.collections.list(project_name="<value>")
121
+ res = lambda_db.collections.list_collections()
122
122
 
123
123
  # Handle response
124
124
  print(res)
@@ -138,7 +138,7 @@ async def main():
138
138
  project_api_key="<YOUR_PROJECT_API_KEY>",
139
139
  ) as lambda_db:
140
140
 
141
- res = await lambda_db.collections.list_async(project_name="<value>")
141
+ res = await lambda_db.collections.list_collections_async()
142
142
 
143
143
  # Handle response
144
144
  print(res)
@@ -167,7 +167,7 @@ with LambdaDB(
167
167
  project_api_key="<YOUR_PROJECT_API_KEY>",
168
168
  ) as lambda_db:
169
169
 
170
- res = lambda_db.collections.list(project_name="<value>")
170
+ res = lambda_db.collections.list_collections()
171
171
 
172
172
  # Handle response
173
173
  print(res)
@@ -183,21 +183,21 @@ with LambdaDB(
183
183
 
184
184
  ### [collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
185
185
 
186
- * [list](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list) - List all collections in an existing project.
187
- * [create](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create) - Create a collection.
188
- * [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#delete) - Delete an existing collection.
189
- * [get](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#get) - Get metadata of an existing collection.
190
- * [update](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update) - Configure a collection.
191
- * [query](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query) - Search a collection with a query and return the most similar documents.
186
+ * [list_collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list_collections) - List all collections in an existing project.
187
+ * [create_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create_collection) - Create a collection.
188
+ * [delete_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#delete_collection) - Delete an existing collection.
189
+ * [get_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#get_collection) - Get metadata of an existing collection.
190
+ * [update_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update_collection) - Configure a collection.
191
+ * [query_collection](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query_collection) - Search a collection with a query and return the most similar documents.
192
192
 
193
193
  #### [collections.docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md)
194
194
 
195
- * [upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert) - Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
196
- * [get_bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert) - Request required info to upload documents.
197
- * [bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#bulk_upsert) - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
195
+ * [upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert_docs) - Upsert documents into a collection. Note that the maximum supported payload size is 6MB.
196
+ * [get_bulk_upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert_docs) - Request required info to upload documents.
197
+ * [bulk_upsert_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#bulk_upsert_docs) - Bulk upsert documents into a collection. Note that the maximum supported object size is 200MB.
198
198
  * [update_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#update_docs) - Update documents in a collection. Note that the maximum supported payload size is 6MB.
199
- * [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete) - Delete documents by document IDs or query filter from a collection.
200
- * [fetch](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch) - Lookup and return documents by document IDs from a collection.
199
+ * [delete_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete_docs) - Delete documents by document IDs or query filter from a collection.
200
+ * [fetch_docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch_docs) - Lookup and return documents by document IDs from a collection.
201
201
 
202
202
 
203
203
  </details>
@@ -218,7 +218,7 @@ with LambdaDB(
218
218
  project_api_key="<YOUR_PROJECT_API_KEY>",
219
219
  ) as lambda_db:
220
220
 
221
- res = lambda_db.collections.list(project_name="<value>",
221
+ res = lambda_db.collections.list_collections(,
222
222
  RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
223
223
 
224
224
  # Handle response
@@ -237,7 +237,7 @@ with LambdaDB(
237
237
  project_api_key="<YOUR_PROJECT_API_KEY>",
238
238
  ) as lambda_db:
239
239
 
240
- res = lambda_db.collections.list(project_name="<value>")
240
+ res = lambda_db.collections.list_collections()
241
241
 
242
242
  # Handle response
243
243
  print(res)
@@ -248,29 +248,18 @@ with LambdaDB(
248
248
  <!-- Start Error Handling [errors] -->
249
249
  ## Error Handling
250
250
 
251
- Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
251
+ [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py) is the base class for all HTTP error responses. It has the following properties:
252
252
 
253
- By default, an API error will raise a errors.APIError exception, which has the following properties:
254
-
255
- | Property | Type | Description |
256
- |-----------------|------------------|-----------------------|
257
- | `.status_code` | *int* | The HTTP status code |
258
- | `.message` | *str* | The error message |
259
- | `.raw_response` | *httpx.Response* | The raw HTTP response |
260
- | `.body` | *str* | The response content |
261
-
262
- When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list_async` method may raise the following exceptions:
263
-
264
- | Error Type | Status Code | Content Type |
265
- | ---------------------------- | ----------- | ---------------- |
266
- | errors.UnauthenticatedError | 401 | application/json |
267
- | errors.ResourceNotFoundError | 404 | application/json |
268
- | errors.TooManyRequestsError | 429 | application/json |
269
- | errors.InternalServerError | 500 | application/json |
270
- | errors.APIError | 4XX, 5XX | \*/\* |
253
+ | Property | Type | Description |
254
+ | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
255
+ | `err.message` | `str` | Error message |
256
+ | `err.status_code` | `int` | HTTP response status code eg `404` |
257
+ | `err.headers` | `httpx.Headers` | HTTP response headers |
258
+ | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
259
+ | `err.raw_response` | `httpx.Response` | Raw HTTP response |
260
+ | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](https://github.com/lambdadb/lambdadb-python-client/blob/master/#error-classes). |
271
261
 
272
262
  ### Example
273
-
274
263
  ```python
275
264
  from lambdadb import LambdaDB, errors
276
265
 
@@ -281,32 +270,82 @@ with LambdaDB(
281
270
  res = None
282
271
  try:
283
272
 
284
- res = lambda_db.collections.list(project_name="<value>")
273
+ res = lambda_db.collections.list_collections()
285
274
 
286
275
  # Handle response
287
276
  print(res)
288
277
 
289
- except errors.UnauthenticatedError as e:
290
- # handle e.data: errors.UnauthenticatedErrorData
291
- raise(e)
292
- except errors.ResourceNotFoundError as e:
293
- # handle e.data: errors.ResourceNotFoundErrorData
294
- raise(e)
295
- except errors.TooManyRequestsError as e:
296
- # handle e.data: errors.TooManyRequestsErrorData
297
- raise(e)
298
- except errors.InternalServerError as e:
299
- # handle e.data: errors.InternalServerErrorData
300
- raise(e)
301
- except errors.APIError as e:
302
- # handle exception
303
- raise(e)
278
+
279
+ except errors.LambdaDBError as e:
280
+ # The base class for HTTP error responses
281
+ print(e.message)
282
+ print(e.status_code)
283
+ print(e.body)
284
+ print(e.headers)
285
+ print(e.raw_response)
286
+
287
+ # Depending on the method different errors may be thrown
288
+ if isinstance(e, errors.UnauthenticatedError):
289
+ print(e.data.message) # Optional[str]
304
290
  ```
291
+
292
+ ### Error Classes
293
+ **Primary errors:**
294
+ * [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py): The base class for HTTP error responses.
295
+ * [`UnauthenticatedError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/unauthenticatederror.py): Unauthenticated. Status code `401`.
296
+ * [`TooManyRequestsError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/toomanyrequestserror.py): Too many requests. Status code `429`.
297
+ * [`InternalServerError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/internalservererror.py): Internal server error. Status code `500`.
298
+ * [`ResourceNotFoundError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/resourcenotfounderror.py): Resource not found. Status code `404`. *
299
+
300
+ <details><summary>Less common errors (7)</summary>
301
+
302
+ <br />
303
+
304
+ **Network errors:**
305
+ * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
306
+ * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
307
+ * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
308
+
309
+
310
+ **Inherit from [`LambdaDBError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/lambdadberror.py)**:
311
+ * [`BadRequestError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/badrequesterror.py): Bad request. Status code `400`. Applicable to 8 of 12 methods.*
312
+ * [`ResourceAlreadyExistsError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/resourcealreadyexistserror.py): Resource already exists. Status code `409`. Applicable to 1 of 12 methods.*
313
+ * [`ResponseValidationError`](https://github.com/lambdadb/lambdadb-python-client/blob/master/./src/lambdadb/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
314
+
315
+ </details>
316
+
317
+ \* Check [the method documentation](https://github.com/lambdadb/lambdadb-python-client/blob/master/#available-resources-and-operations) to see if the error is applicable.
305
318
  <!-- End Error Handling [errors] -->
306
319
 
307
320
  <!-- Start Server Selection [server] -->
308
321
  ## Server Selection
309
322
 
323
+ ### Server Variables
324
+
325
+ The default server `https://{baseUrl}` contains variables and is set to `https://api.lambdadb.com/projects/default` by default. To override default values, the following parameters are available when initializing the SDK client instance:
326
+
327
+ | Variable | Parameter | Default | Description |
328
+ | --------- | --------------- | ------------------------------------- | ----------------------- |
329
+ | `baseUrl` | `base_url: str` | `"api.lambdadb.com/projects/default"` | The base URL of the API |
330
+
331
+ #### Example
332
+
333
+ ```python
334
+ from lambdadb import LambdaDB
335
+
336
+
337
+ with LambdaDB(
338
+ base_url="https://functional-jury.net/"
339
+ project_api_key="<YOUR_PROJECT_API_KEY>",
340
+ ) as lambda_db:
341
+
342
+ res = lambda_db.collections.list_collections()
343
+
344
+ # Handle response
345
+ print(res)
346
+
347
+ ```
348
+
310
349
  ### Override Server URL Per-Client
311
350
 
312
351
  The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
@@ -315,11 +354,11 @@ from lambdadb import LambdaDB
315
354
 
316
355
 
317
356
  with LambdaDB(
318
- server_url="https://{baseUrl}",
357
+ server_url="https://api.lambdadb.com/projects/default",
319
358
  project_api_key="<YOUR_PROJECT_API_KEY>",
320
359
  ) as lambda_db:
321
360
 
322
- res = lambda_db.collections.list(project_name="<value>")
361
+ res = lambda_db.collections.list_collections()
323
362
 
324
363
  # Handle response
325
364
  print(res)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lambdadb"
3
- version = "0.3.5"
3
+ version = "0.4.0"
4
4
  description = "Python Client SDK Generated by Speakeasy."
5
5
  authors = [{ name = "Speakeasy" },]
6
6
  readme = "README-PYPI.md"
@@ -3,10 +3,10 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "lambdadb"
6
- __version__: str = "0.3.5"
6
+ __version__: str = "0.4.0"
7
7
  __openapi_doc_version__: str = "1.1.1"
8
- __gen_version__: str = "2.644.1"
9
- __user_agent__: str = "speakeasy-sdk/python 0.3.5 2.644.1 1.1.1 lambdadb"
8
+ __gen_version__: str = "2.647.2"
9
+ __user_agent__: str = "speakeasy-sdk/python 0.4.0 2.647.2 1.1.1 lambdadb"
10
10
 
11
11
  try:
12
12
  if __package__ is not None:
@@ -240,7 +240,7 @@ class BaseSDK:
240
240
 
241
241
  if http_res is None:
242
242
  logger.debug("Raising no response SDK error")
243
- raise errors.APIError("No response received")
243
+ raise errors.NoResponseError("No response received")
244
244
 
245
245
  logger.debug(
246
246
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -261,7 +261,7 @@ class BaseSDK:
261
261
  http_res = result
262
262
  else:
263
263
  logger.debug("Raising unexpected SDK error")
264
- raise errors.APIError("Unexpected error occurred")
264
+ raise errors.APIError("Unexpected error occurred", http_res)
265
265
 
266
266
  return http_res
267
267
 
@@ -312,7 +312,7 @@ class BaseSDK:
312
312
 
313
313
  if http_res is None:
314
314
  logger.debug("Raising no response SDK error")
315
- raise errors.APIError("No response received")
315
+ raise errors.NoResponseError("No response received")
316
316
 
317
317
  logger.debug(
318
318
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -333,7 +333,7 @@ class BaseSDK:
333
333
  http_res = result
334
334
  else:
335
335
  logger.debug("Raising unexpected SDK error")
336
- raise errors.APIError("Unexpected error occurred")
336
+ raise errors.APIError("Unexpected error occurred", http_res)
337
337
 
338
338
  return http_res
339
339