worqhat 3.1.0__py3-none-any.whl → 3.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.
Files changed (30) hide show
  1. worqhat/_base_client.py +4 -1
  2. worqhat/_client.py +24 -16
  3. worqhat/_files.py +5 -5
  4. worqhat/_version.py +1 -1
  5. worqhat/resources/__init__.py +14 -0
  6. worqhat/resources/db.py +593 -0
  7. worqhat/resources/flows.py +235 -21
  8. worqhat/types/__init__.py +17 -3
  9. worqhat/types/db_delete_records_params.py +15 -0
  10. worqhat/types/db_delete_records_response.py +18 -0
  11. worqhat/types/db_execute_query_params.py +12 -0
  12. worqhat/types/db_execute_query_response.py +21 -0
  13. worqhat/types/db_insert_record_params.py +15 -0
  14. worqhat/types/db_insert_record_response.py +15 -0
  15. worqhat/types/db_process_nl_query_params.py +15 -0
  16. worqhat/types/db_process_nl_query_response.py +18 -0
  17. worqhat/types/db_update_records_params.py +18 -0
  18. worqhat/types/db_update_records_response.py +18 -0
  19. worqhat/types/{flow_retrieve_metrics_params.py → flow_get_metrics_params.py} +2 -2
  20. worqhat/types/{flow_retrieve_metrics_response.py → flow_get_metrics_response.py} +2 -2
  21. worqhat/types/flow_trigger_with_file_params.py +17 -0
  22. worqhat/types/flow_trigger_with_file_response.py +18 -0
  23. worqhat/types/flow_trigger_with_payload_params.py +12 -0
  24. worqhat/types/flow_trigger_with_payload_response.py +20 -0
  25. worqhat/types/{retrieve_server_info_response.py → get_server_info_response.py} +2 -2
  26. {worqhat-3.1.0.dist-info → worqhat-3.4.0.dist-info}/METADATA +49 -15
  27. worqhat-3.4.0.dist-info/RECORD +53 -0
  28. worqhat-3.1.0.dist-info/RECORD +0 -38
  29. {worqhat-3.1.0.dist-info → worqhat-3.4.0.dist-info}/WHEEL +0 -0
  30. {worqhat-3.1.0.dist-info → worqhat-3.4.0.dist-info}/licenses/LICENSE +0 -0
worqhat/_base_client.py CHANGED
@@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
532
532
  is_body_allowed = options.method.lower() != "get"
533
533
 
534
534
  if is_body_allowed:
535
- kwargs["json"] = json_data if is_given(json_data) else None
535
+ if isinstance(json_data, bytes):
536
+ kwargs["content"] = json_data
537
+ else:
538
+ kwargs["json"] = json_data if is_given(json_data) else None
536
539
  kwargs["files"] = files
537
540
  else:
538
541
  headers.pop("Content-Type", None)
worqhat/_client.py CHANGED
@@ -30,7 +30,7 @@ from ._response import (
30
30
  async_to_raw_response_wrapper,
31
31
  async_to_streamed_response_wrapper,
32
32
  )
33
- from .resources import flows, health
33
+ from .resources import db, flows, health
34
34
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
35
35
  from ._exceptions import WorqhatError, APIStatusError
36
36
  from ._base_client import (
@@ -39,12 +39,13 @@ from ._base_client import (
39
39
  AsyncAPIClient,
40
40
  make_request_options,
41
41
  )
42
- from .types.retrieve_server_info_response import RetrieveServerInfoResponse
42
+ from .types.get_server_info_response import GetServerInfoResponse
43
43
 
44
44
  __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Worqhat", "AsyncWorqhat", "Client", "AsyncClient"]
45
45
 
46
46
 
47
47
  class Worqhat(SyncAPIClient):
48
+ db: db.DBResource
48
49
  health: health.HealthResource
49
50
  flows: flows.FlowsResource
50
51
  with_raw_response: WorqhatWithRawResponse
@@ -104,6 +105,7 @@ class Worqhat(SyncAPIClient):
104
105
  _strict_response_validation=_strict_response_validation,
105
106
  )
106
107
 
108
+ self.db = db.DBResource(self)
107
109
  self.health = health.HealthResource(self)
108
110
  self.flows = flows.FlowsResource(self)
109
111
  self.with_raw_response = WorqhatWithRawResponse(self)
@@ -180,7 +182,7 @@ class Worqhat(SyncAPIClient):
180
182
  # client.with_options(timeout=10).foo.create(...)
181
183
  with_options = copy
182
184
 
183
- def retrieve_server_info(
185
+ def get_server_info(
184
186
  self,
185
187
  *,
186
188
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -189,14 +191,14 @@ class Worqhat(SyncAPIClient):
189
191
  extra_query: Query | None = None,
190
192
  extra_body: Body | None = None,
191
193
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
192
- ) -> RetrieveServerInfoResponse:
194
+ ) -> GetServerInfoResponse:
193
195
  """Get basic server information and status"""
194
196
  return self.get(
195
197
  "/",
196
198
  options=make_request_options(
197
199
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
198
200
  ),
199
- cast_to=RetrieveServerInfoResponse,
201
+ cast_to=GetServerInfoResponse,
200
202
  )
201
203
 
202
204
  @override
@@ -234,6 +236,7 @@ class Worqhat(SyncAPIClient):
234
236
 
235
237
 
236
238
  class AsyncWorqhat(AsyncAPIClient):
239
+ db: db.AsyncDBResource
237
240
  health: health.AsyncHealthResource
238
241
  flows: flows.AsyncFlowsResource
239
242
  with_raw_response: AsyncWorqhatWithRawResponse
@@ -293,6 +296,7 @@ class AsyncWorqhat(AsyncAPIClient):
293
296
  _strict_response_validation=_strict_response_validation,
294
297
  )
295
298
 
299
+ self.db = db.AsyncDBResource(self)
296
300
  self.health = health.AsyncHealthResource(self)
297
301
  self.flows = flows.AsyncFlowsResource(self)
298
302
  self.with_raw_response = AsyncWorqhatWithRawResponse(self)
@@ -369,7 +373,7 @@ class AsyncWorqhat(AsyncAPIClient):
369
373
  # client.with_options(timeout=10).foo.create(...)
370
374
  with_options = copy
371
375
 
372
- async def retrieve_server_info(
376
+ async def get_server_info(
373
377
  self,
374
378
  *,
375
379
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -378,14 +382,14 @@ class AsyncWorqhat(AsyncAPIClient):
378
382
  extra_query: Query | None = None,
379
383
  extra_body: Body | None = None,
380
384
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
381
- ) -> RetrieveServerInfoResponse:
385
+ ) -> GetServerInfoResponse:
382
386
  """Get basic server information and status"""
383
387
  return await self.get(
384
388
  "/",
385
389
  options=make_request_options(
386
390
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
387
391
  ),
388
- cast_to=RetrieveServerInfoResponse,
392
+ cast_to=GetServerInfoResponse,
389
393
  )
390
394
 
391
395
  @override
@@ -424,41 +428,45 @@ class AsyncWorqhat(AsyncAPIClient):
424
428
 
425
429
  class WorqhatWithRawResponse:
426
430
  def __init__(self, client: Worqhat) -> None:
431
+ self.db = db.DBResourceWithRawResponse(client.db)
427
432
  self.health = health.HealthResourceWithRawResponse(client.health)
428
433
  self.flows = flows.FlowsResourceWithRawResponse(client.flows)
429
434
 
430
- self.retrieve_server_info = to_raw_response_wrapper(
431
- client.retrieve_server_info,
435
+ self.get_server_info = to_raw_response_wrapper(
436
+ client.get_server_info,
432
437
  )
433
438
 
434
439
 
435
440
  class AsyncWorqhatWithRawResponse:
436
441
  def __init__(self, client: AsyncWorqhat) -> None:
442
+ self.db = db.AsyncDBResourceWithRawResponse(client.db)
437
443
  self.health = health.AsyncHealthResourceWithRawResponse(client.health)
438
444
  self.flows = flows.AsyncFlowsResourceWithRawResponse(client.flows)
439
445
 
440
- self.retrieve_server_info = async_to_raw_response_wrapper(
441
- client.retrieve_server_info,
446
+ self.get_server_info = async_to_raw_response_wrapper(
447
+ client.get_server_info,
442
448
  )
443
449
 
444
450
 
445
451
  class WorqhatWithStreamedResponse:
446
452
  def __init__(self, client: Worqhat) -> None:
453
+ self.db = db.DBResourceWithStreamingResponse(client.db)
447
454
  self.health = health.HealthResourceWithStreamingResponse(client.health)
448
455
  self.flows = flows.FlowsResourceWithStreamingResponse(client.flows)
449
456
 
450
- self.retrieve_server_info = to_streamed_response_wrapper(
451
- client.retrieve_server_info,
457
+ self.get_server_info = to_streamed_response_wrapper(
458
+ client.get_server_info,
452
459
  )
453
460
 
454
461
 
455
462
  class AsyncWorqhatWithStreamedResponse:
456
463
  def __init__(self, client: AsyncWorqhat) -> None:
464
+ self.db = db.AsyncDBResourceWithStreamingResponse(client.db)
457
465
  self.health = health.AsyncHealthResourceWithStreamingResponse(client.health)
458
466
  self.flows = flows.AsyncFlowsResourceWithStreamingResponse(client.flows)
459
467
 
460
- self.retrieve_server_info = async_to_streamed_response_wrapper(
461
- client.retrieve_server_info,
468
+ self.get_server_info = async_to_streamed_response_wrapper(
469
+ client.get_server_info,
462
470
  )
463
471
 
464
472
 
worqhat/_files.py CHANGED
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
34
34
  if not is_file_content(obj):
35
35
  prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
36
36
  raise RuntimeError(
37
- f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead."
37
+ f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/WorqHat/worqhat-python-sdk/tree/main#file-uploads"
38
38
  ) from None
39
39
 
40
40
 
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
69
69
  return file
70
70
 
71
71
  if is_tuple_t(file):
72
- return (file[0], _read_file_content(file[1]), *file[2:])
72
+ return (file[0], read_file_content(file[1]), *file[2:])
73
73
 
74
74
  raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
75
75
 
76
76
 
77
- def _read_file_content(file: FileContent) -> HttpxFileContent:
77
+ def read_file_content(file: FileContent) -> HttpxFileContent:
78
78
  if isinstance(file, os.PathLike):
79
79
  return pathlib.Path(file).read_bytes()
80
80
  return file
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
111
111
  return file
112
112
 
113
113
  if is_tuple_t(file):
114
- return (file[0], await _async_read_file_content(file[1]), *file[2:])
114
+ return (file[0], await async_read_file_content(file[1]), *file[2:])
115
115
 
116
116
  raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
117
117
 
118
118
 
119
- async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
119
+ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
120
120
  if isinstance(file, os.PathLike):
121
121
  return await anyio.Path(file).read_bytes()
122
122
 
worqhat/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "worqhat"
4
- __version__ = "3.1.0" # x-release-please-version
4
+ __version__ = "3.4.0" # x-release-please-version
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .db import (
4
+ DBResource,
5
+ AsyncDBResource,
6
+ DBResourceWithRawResponse,
7
+ AsyncDBResourceWithRawResponse,
8
+ DBResourceWithStreamingResponse,
9
+ AsyncDBResourceWithStreamingResponse,
10
+ )
3
11
  from .flows import (
4
12
  FlowsResource,
5
13
  AsyncFlowsResource,
@@ -18,6 +26,12 @@ from .health import (
18
26
  )
19
27
 
20
28
  __all__ = [
29
+ "DBResource",
30
+ "AsyncDBResource",
31
+ "DBResourceWithRawResponse",
32
+ "AsyncDBResourceWithRawResponse",
33
+ "DBResourceWithStreamingResponse",
34
+ "AsyncDBResourceWithStreamingResponse",
21
35
  "HealthResource",
22
36
  "AsyncHealthResource",
23
37
  "HealthResourceWithRawResponse",