worqhat 3.5.0__py3-none-any.whl → 3.8.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 (56) hide show
  1. worqhat/__init__.py +3 -1
  2. worqhat/_base_client.py +12 -12
  3. worqhat/_client.py +21 -11
  4. worqhat/_compat.py +48 -48
  5. worqhat/_models.py +51 -45
  6. worqhat/_qs.py +7 -7
  7. worqhat/_types.py +53 -12
  8. worqhat/_utils/__init__.py +9 -2
  9. worqhat/_utils/_compat.py +45 -0
  10. worqhat/_utils/_datetime_parse.py +136 -0
  11. worqhat/_utils/_transform.py +13 -3
  12. worqhat/_utils/_typing.py +6 -1
  13. worqhat/_utils/_utils.py +4 -5
  14. worqhat/_version.py +1 -1
  15. worqhat/resources/__init__.py +14 -0
  16. worqhat/resources/client/__init__.py +33 -0
  17. worqhat/resources/client/client.py +102 -0
  18. worqhat/resources/client/storage.py +462 -0
  19. worqhat/resources/db/__init__.py +33 -0
  20. worqhat/resources/{db.py → db/db.py} +245 -32
  21. worqhat/resources/db/tables.py +389 -0
  22. worqhat/resources/flows.py +29 -23
  23. worqhat/resources/health.py +3 -3
  24. worqhat/types/__init__.py +2 -0
  25. worqhat/types/client/__init__.py +12 -0
  26. worqhat/types/client/storage_delete_file_by_id_response.py +18 -0
  27. worqhat/types/client/storage_retrieve_file_by_id_response.py +33 -0
  28. worqhat/types/client/storage_retrieve_file_by_path_params.py +12 -0
  29. worqhat/types/client/storage_retrieve_file_by_path_response.py +33 -0
  30. worqhat/types/client/storage_upload_file_params.py +17 -0
  31. worqhat/types/client/storage_upload_file_response.py +33 -0
  32. worqhat/types/db/__init__.py +10 -0
  33. worqhat/types/db/table_get_row_count_params.py +12 -0
  34. worqhat/types/db/table_get_row_count_response.py +15 -0
  35. worqhat/types/db/table_list_params.py +15 -0
  36. worqhat/types/db/table_list_response.py +26 -0
  37. worqhat/types/db/table_retrieve_schema_params.py +12 -0
  38. worqhat/types/db/table_retrieve_schema_response.py +29 -0
  39. worqhat/types/db_delete_records_params.py +6 -2
  40. worqhat/types/db_delete_records_response.py +2 -2
  41. worqhat/types/db_execute_batch_params.py +36 -0
  42. worqhat/types/db_execute_batch_response.py +27 -0
  43. worqhat/types/db_execute_query_params.py +8 -1
  44. worqhat/types/db_execute_query_response.py +2 -2
  45. worqhat/types/db_insert_record_params.py +6 -2
  46. worqhat/types/db_insert_record_response.py +2 -2
  47. worqhat/types/db_process_nl_query_params.py +8 -1
  48. worqhat/types/db_process_nl_query_response.py +2 -2
  49. worqhat/types/db_update_records_params.py +7 -3
  50. worqhat/types/db_update_records_response.py +2 -2
  51. worqhat/types/flow_trigger_with_payload_params.py +3 -2
  52. {worqhat-3.5.0.dist-info → worqhat-3.8.0.dist-info}/METADATA +2 -2
  53. worqhat-3.8.0.dist-info/RECORD +76 -0
  54. worqhat-3.5.0.dist-info/RECORD +0 -53
  55. {worqhat-3.5.0.dist-info → worqhat-3.8.0.dist-info}/WHEEL +0 -0
  56. {worqhat-3.5.0.dist-info → worqhat-3.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,462 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Mapping, cast
6
+
7
+ import httpx
8
+
9
+ from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
10
+ from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
11
+ from ..._compat import cached_property
12
+ from ..._resource import SyncAPIResource, AsyncAPIResource
13
+ from ..._response import (
14
+ to_raw_response_wrapper,
15
+ to_streamed_response_wrapper,
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ )
19
+ from ..._base_client import make_request_options
20
+ from ...types.client import storage_upload_file_params, storage_retrieve_file_by_path_params
21
+ from ...types.client.storage_upload_file_response import StorageUploadFileResponse
22
+ from ...types.client.storage_delete_file_by_id_response import StorageDeleteFileByIDResponse
23
+ from ...types.client.storage_retrieve_file_by_id_response import StorageRetrieveFileByIDResponse
24
+ from ...types.client.storage_retrieve_file_by_path_response import StorageRetrieveFileByPathResponse
25
+
26
+ __all__ = ["StorageResource", "AsyncStorageResource"]
27
+
28
+
29
+ class StorageResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> StorageResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#accessing-raw-response-data-eg-headers
37
+ """
38
+ return StorageResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> StorageResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#with_streaming_response
46
+ """
47
+ return StorageResourceWithStreamingResponse(self)
48
+
49
+ def delete_file_by_id(
50
+ self,
51
+ file_id: str,
52
+ *,
53
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54
+ # The extra values given here take precedence over values defined on the client or passed to this method.
55
+ extra_headers: Headers | None = None,
56
+ extra_query: Query | None = None,
57
+ extra_body: Body | None = None,
58
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
59
+ ) -> StorageDeleteFileByIDResponse:
60
+ """Permanently deletes a file from storage by its unique ID.
61
+
62
+ This action cannot be
63
+ undone.
64
+
65
+ Args:
66
+ extra_headers: Send extra headers
67
+
68
+ extra_query: Add additional query parameters to the request
69
+
70
+ extra_body: Add additional JSON properties to the request
71
+
72
+ timeout: Override the client-level default timeout for this request, in seconds
73
+ """
74
+ if not file_id:
75
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
76
+ return self._delete(
77
+ f"/storage/delete/{file_id}",
78
+ options=make_request_options(
79
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
80
+ ),
81
+ cast_to=StorageDeleteFileByIDResponse,
82
+ )
83
+
84
+ def retrieve_file_by_id(
85
+ self,
86
+ file_id: str,
87
+ *,
88
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
89
+ # The extra values given here take precedence over values defined on the client or passed to this method.
90
+ extra_headers: Headers | None = None,
91
+ extra_query: Query | None = None,
92
+ extra_body: Body | None = None,
93
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
94
+ ) -> StorageRetrieveFileByIDResponse:
95
+ """Retrieves a file from storage by its unique ID.
96
+
97
+ Returns the file metadata and a
98
+ download URL.
99
+
100
+ Args:
101
+ extra_headers: Send extra headers
102
+
103
+ extra_query: Add additional query parameters to the request
104
+
105
+ extra_body: Add additional JSON properties to the request
106
+
107
+ timeout: Override the client-level default timeout for this request, in seconds
108
+ """
109
+ if not file_id:
110
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
111
+ return self._get(
112
+ f"/storage/fetch/{file_id}",
113
+ options=make_request_options(
114
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
115
+ ),
116
+ cast_to=StorageRetrieveFileByIDResponse,
117
+ )
118
+
119
+ def retrieve_file_by_path(
120
+ self,
121
+ *,
122
+ filepath: str,
123
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
124
+ # The extra values given here take precedence over values defined on the client or passed to this method.
125
+ extra_headers: Headers | None = None,
126
+ extra_query: Query | None = None,
127
+ extra_body: Body | None = None,
128
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
129
+ ) -> StorageRetrieveFileByPathResponse:
130
+ """
131
+ Retrieves a file from storage by its path within the organization's storage.
132
+ Returns the file metadata and a download URL.
133
+
134
+ Args:
135
+ filepath: Path to the file within organization storage
136
+
137
+ extra_headers: Send extra headers
138
+
139
+ extra_query: Add additional query parameters to the request
140
+
141
+ extra_body: Add additional JSON properties to the request
142
+
143
+ timeout: Override the client-level default timeout for this request, in seconds
144
+ """
145
+ return self._get(
146
+ "/storage/fetch-by-path",
147
+ options=make_request_options(
148
+ extra_headers=extra_headers,
149
+ extra_query=extra_query,
150
+ extra_body=extra_body,
151
+ timeout=timeout,
152
+ query=maybe_transform(
153
+ {"filepath": filepath}, storage_retrieve_file_by_path_params.StorageRetrieveFileByPathParams
154
+ ),
155
+ ),
156
+ cast_to=StorageRetrieveFileByPathResponse,
157
+ )
158
+
159
+ def upload_file(
160
+ self,
161
+ *,
162
+ file: FileTypes,
163
+ path: str | Omit = omit,
164
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
165
+ # The extra values given here take precedence over values defined on the client or passed to this method.
166
+ extra_headers: Headers | None = None,
167
+ extra_query: Query | None = None,
168
+ extra_body: Body | None = None,
169
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
170
+ ) -> StorageUploadFileResponse:
171
+ """Uploads a file to S3 storage and returns the file ID and metadata.
172
+
173
+ Optionally
174
+ specify a custom path within the organization's storage bucket.
175
+
176
+ Args:
177
+ file: File to upload (max 50MB)
178
+
179
+ path: Optional custom path within organization storage
180
+
181
+ extra_headers: Send extra headers
182
+
183
+ extra_query: Add additional query parameters to the request
184
+
185
+ extra_body: Add additional JSON properties to the request
186
+
187
+ timeout: Override the client-level default timeout for this request, in seconds
188
+ """
189
+ body = deepcopy_minimal(
190
+ {
191
+ "file": file,
192
+ "path": path,
193
+ }
194
+ )
195
+ files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
196
+ # It should be noted that the actual Content-Type header that will be
197
+ # sent to the server will contain a `boundary` parameter, e.g.
198
+ # multipart/form-data; boundary=---abc--
199
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
200
+ return self._post(
201
+ "/storage/upload",
202
+ body=maybe_transform(body, storage_upload_file_params.StorageUploadFileParams),
203
+ files=files,
204
+ options=make_request_options(
205
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
206
+ ),
207
+ cast_to=StorageUploadFileResponse,
208
+ )
209
+
210
+
211
+ class AsyncStorageResource(AsyncAPIResource):
212
+ @cached_property
213
+ def with_raw_response(self) -> AsyncStorageResourceWithRawResponse:
214
+ """
215
+ This property can be used as a prefix for any HTTP method call to return
216
+ the raw response object instead of the parsed content.
217
+
218
+ For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#accessing-raw-response-data-eg-headers
219
+ """
220
+ return AsyncStorageResourceWithRawResponse(self)
221
+
222
+ @cached_property
223
+ def with_streaming_response(self) -> AsyncStorageResourceWithStreamingResponse:
224
+ """
225
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
226
+
227
+ For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#with_streaming_response
228
+ """
229
+ return AsyncStorageResourceWithStreamingResponse(self)
230
+
231
+ async def delete_file_by_id(
232
+ self,
233
+ file_id: str,
234
+ *,
235
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
236
+ # The extra values given here take precedence over values defined on the client or passed to this method.
237
+ extra_headers: Headers | None = None,
238
+ extra_query: Query | None = None,
239
+ extra_body: Body | None = None,
240
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
241
+ ) -> StorageDeleteFileByIDResponse:
242
+ """Permanently deletes a file from storage by its unique ID.
243
+
244
+ This action cannot be
245
+ undone.
246
+
247
+ Args:
248
+ extra_headers: Send extra headers
249
+
250
+ extra_query: Add additional query parameters to the request
251
+
252
+ extra_body: Add additional JSON properties to the request
253
+
254
+ timeout: Override the client-level default timeout for this request, in seconds
255
+ """
256
+ if not file_id:
257
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
258
+ return await self._delete(
259
+ f"/storage/delete/{file_id}",
260
+ options=make_request_options(
261
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
262
+ ),
263
+ cast_to=StorageDeleteFileByIDResponse,
264
+ )
265
+
266
+ async def retrieve_file_by_id(
267
+ self,
268
+ file_id: str,
269
+ *,
270
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
271
+ # The extra values given here take precedence over values defined on the client or passed to this method.
272
+ extra_headers: Headers | None = None,
273
+ extra_query: Query | None = None,
274
+ extra_body: Body | None = None,
275
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
276
+ ) -> StorageRetrieveFileByIDResponse:
277
+ """Retrieves a file from storage by its unique ID.
278
+
279
+ Returns the file metadata and a
280
+ download URL.
281
+
282
+ Args:
283
+ extra_headers: Send extra headers
284
+
285
+ extra_query: Add additional query parameters to the request
286
+
287
+ extra_body: Add additional JSON properties to the request
288
+
289
+ timeout: Override the client-level default timeout for this request, in seconds
290
+ """
291
+ if not file_id:
292
+ raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
293
+ return await self._get(
294
+ f"/storage/fetch/{file_id}",
295
+ options=make_request_options(
296
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
297
+ ),
298
+ cast_to=StorageRetrieveFileByIDResponse,
299
+ )
300
+
301
+ async def retrieve_file_by_path(
302
+ self,
303
+ *,
304
+ filepath: str,
305
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
306
+ # The extra values given here take precedence over values defined on the client or passed to this method.
307
+ extra_headers: Headers | None = None,
308
+ extra_query: Query | None = None,
309
+ extra_body: Body | None = None,
310
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
311
+ ) -> StorageRetrieveFileByPathResponse:
312
+ """
313
+ Retrieves a file from storage by its path within the organization's storage.
314
+ Returns the file metadata and a download URL.
315
+
316
+ Args:
317
+ filepath: Path to the file within organization storage
318
+
319
+ extra_headers: Send extra headers
320
+
321
+ extra_query: Add additional query parameters to the request
322
+
323
+ extra_body: Add additional JSON properties to the request
324
+
325
+ timeout: Override the client-level default timeout for this request, in seconds
326
+ """
327
+ return await self._get(
328
+ "/storage/fetch-by-path",
329
+ options=make_request_options(
330
+ extra_headers=extra_headers,
331
+ extra_query=extra_query,
332
+ extra_body=extra_body,
333
+ timeout=timeout,
334
+ query=await async_maybe_transform(
335
+ {"filepath": filepath}, storage_retrieve_file_by_path_params.StorageRetrieveFileByPathParams
336
+ ),
337
+ ),
338
+ cast_to=StorageRetrieveFileByPathResponse,
339
+ )
340
+
341
+ async def upload_file(
342
+ self,
343
+ *,
344
+ file: FileTypes,
345
+ path: str | Omit = omit,
346
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
347
+ # The extra values given here take precedence over values defined on the client or passed to this method.
348
+ extra_headers: Headers | None = None,
349
+ extra_query: Query | None = None,
350
+ extra_body: Body | None = None,
351
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
352
+ ) -> StorageUploadFileResponse:
353
+ """Uploads a file to S3 storage and returns the file ID and metadata.
354
+
355
+ Optionally
356
+ specify a custom path within the organization's storage bucket.
357
+
358
+ Args:
359
+ file: File to upload (max 50MB)
360
+
361
+ path: Optional custom path within organization storage
362
+
363
+ extra_headers: Send extra headers
364
+
365
+ extra_query: Add additional query parameters to the request
366
+
367
+ extra_body: Add additional JSON properties to the request
368
+
369
+ timeout: Override the client-level default timeout for this request, in seconds
370
+ """
371
+ body = deepcopy_minimal(
372
+ {
373
+ "file": file,
374
+ "path": path,
375
+ }
376
+ )
377
+ files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
378
+ # It should be noted that the actual Content-Type header that will be
379
+ # sent to the server will contain a `boundary` parameter, e.g.
380
+ # multipart/form-data; boundary=---abc--
381
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
382
+ return await self._post(
383
+ "/storage/upload",
384
+ body=await async_maybe_transform(body, storage_upload_file_params.StorageUploadFileParams),
385
+ files=files,
386
+ options=make_request_options(
387
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
388
+ ),
389
+ cast_to=StorageUploadFileResponse,
390
+ )
391
+
392
+
393
+ class StorageResourceWithRawResponse:
394
+ def __init__(self, storage: StorageResource) -> None:
395
+ self._storage = storage
396
+
397
+ self.delete_file_by_id = to_raw_response_wrapper(
398
+ storage.delete_file_by_id,
399
+ )
400
+ self.retrieve_file_by_id = to_raw_response_wrapper(
401
+ storage.retrieve_file_by_id,
402
+ )
403
+ self.retrieve_file_by_path = to_raw_response_wrapper(
404
+ storage.retrieve_file_by_path,
405
+ )
406
+ self.upload_file = to_raw_response_wrapper(
407
+ storage.upload_file,
408
+ )
409
+
410
+
411
+ class AsyncStorageResourceWithRawResponse:
412
+ def __init__(self, storage: AsyncStorageResource) -> None:
413
+ self._storage = storage
414
+
415
+ self.delete_file_by_id = async_to_raw_response_wrapper(
416
+ storage.delete_file_by_id,
417
+ )
418
+ self.retrieve_file_by_id = async_to_raw_response_wrapper(
419
+ storage.retrieve_file_by_id,
420
+ )
421
+ self.retrieve_file_by_path = async_to_raw_response_wrapper(
422
+ storage.retrieve_file_by_path,
423
+ )
424
+ self.upload_file = async_to_raw_response_wrapper(
425
+ storage.upload_file,
426
+ )
427
+
428
+
429
+ class StorageResourceWithStreamingResponse:
430
+ def __init__(self, storage: StorageResource) -> None:
431
+ self._storage = storage
432
+
433
+ self.delete_file_by_id = to_streamed_response_wrapper(
434
+ storage.delete_file_by_id,
435
+ )
436
+ self.retrieve_file_by_id = to_streamed_response_wrapper(
437
+ storage.retrieve_file_by_id,
438
+ )
439
+ self.retrieve_file_by_path = to_streamed_response_wrapper(
440
+ storage.retrieve_file_by_path,
441
+ )
442
+ self.upload_file = to_streamed_response_wrapper(
443
+ storage.upload_file,
444
+ )
445
+
446
+
447
+ class AsyncStorageResourceWithStreamingResponse:
448
+ def __init__(self, storage: AsyncStorageResource) -> None:
449
+ self._storage = storage
450
+
451
+ self.delete_file_by_id = async_to_streamed_response_wrapper(
452
+ storage.delete_file_by_id,
453
+ )
454
+ self.retrieve_file_by_id = async_to_streamed_response_wrapper(
455
+ storage.retrieve_file_by_id,
456
+ )
457
+ self.retrieve_file_by_path = async_to_streamed_response_wrapper(
458
+ storage.retrieve_file_by_path,
459
+ )
460
+ self.upload_file = async_to_streamed_response_wrapper(
461
+ storage.upload_file,
462
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .db import (
4
+ DBResource,
5
+ AsyncDBResource,
6
+ DBResourceWithRawResponse,
7
+ AsyncDBResourceWithRawResponse,
8
+ DBResourceWithStreamingResponse,
9
+ AsyncDBResourceWithStreamingResponse,
10
+ )
11
+ from .tables import (
12
+ TablesResource,
13
+ AsyncTablesResource,
14
+ TablesResourceWithRawResponse,
15
+ AsyncTablesResourceWithRawResponse,
16
+ TablesResourceWithStreamingResponse,
17
+ AsyncTablesResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "TablesResource",
22
+ "AsyncTablesResource",
23
+ "TablesResourceWithRawResponse",
24
+ "AsyncTablesResourceWithRawResponse",
25
+ "TablesResourceWithStreamingResponse",
26
+ "AsyncTablesResourceWithStreamingResponse",
27
+ "DBResource",
28
+ "AsyncDBResource",
29
+ "DBResourceWithRawResponse",
30
+ "AsyncDBResourceWithRawResponse",
31
+ "DBResourceWithStreamingResponse",
32
+ "AsyncDBResourceWithStreamingResponse",
33
+ ]