syncsdk 0.1.9__tar.gz → 0.2.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.
Files changed (69) hide show
  1. {syncsdk-0.1.9 → syncsdk-0.2.0}/PKG-INFO +9 -33
  2. {syncsdk-0.1.9 → syncsdk-0.2.0}/README.md +8 -32
  3. {syncsdk-0.1.9 → syncsdk-0.2.0}/pyproject.toml +1 -1
  4. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/__init__.py +20 -1
  5. syncsdk-0.2.0/src/sync/batch/client.py +311 -0
  6. syncsdk-0.2.0/src/sync/batch/raw_client.py +537 -0
  7. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/client.py +4 -0
  8. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/__init__.py +24 -1
  9. syncsdk-0.2.0/src/sync/common/errors/__init__.py +17 -0
  10. syncsdk-0.2.0/src/sync/common/errors/payment_required_error.py +9 -0
  11. syncsdk-0.2.0/src/sync/common/errors/too_many_requests_error.py +9 -0
  12. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/__init__.py +14 -0
  13. syncsdk-0.2.0/src/sync/common/types/active_speaker.py +26 -0
  14. syncsdk-0.2.0/src/sync/common/types/batch_id.py +3 -0
  15. syncsdk-0.2.0/src/sync/common/types/batch_metrics.py +37 -0
  16. syncsdk-0.2.0/src/sync/common/types/batch_response.py +51 -0
  17. syncsdk-0.2.0/src/sync/common/types/batch_status.py +5 -0
  18. syncsdk-0.2.0/src/sync/common/types/create_batch_response.py +7 -0
  19. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/create_generation_dto.py +7 -0
  20. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/generation.py +7 -0
  21. syncsdk-0.2.0/src/sync/common/types/generation_options.py +39 -0
  22. syncsdk-0.2.0/src/sync/common/types/model.py +5 -0
  23. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/sync_mode.py +1 -1
  24. syncsdk-0.2.0/src/sync/common/types/validation_response.py +22 -0
  25. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/client_wrapper.py +2 -2
  26. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/environment.py +1 -0
  27. syncsdk-0.2.0/src/sync/generations/__init__.py +2 -0
  28. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/generations/client.py +167 -4
  29. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/generations/raw_client.py +217 -0
  30. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/webhooks/types/generation_notification.py +7 -0
  31. syncsdk-0.1.9/src/sync/common/errors/__init__.py +0 -8
  32. syncsdk-0.1.9/src/sync/common/types/generation_options.py +0 -58
  33. syncsdk-0.1.9/src/sync/common/types/model.py +0 -7
  34. {syncsdk-0.1.9/src/sync/generations → syncsdk-0.2.0/src/sync/batch}/__init__.py +0 -0
  35. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/errors/bad_request_error.py +0 -0
  36. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/errors/internal_server_error.py +0 -0
  37. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/errors/not_found_error.py +0 -0
  38. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/errors/unauthorized_error.py +0 -0
  39. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/audio.py +0 -0
  40. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/eleven_labs.py +0 -0
  41. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/estimated_generation_cost.py +0 -0
  42. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/generation_error.py +0 -0
  43. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/generation_error_message.py +0 -0
  44. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/generation_id.py +0 -0
  45. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/generation_status.py +0 -0
  46. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/input.py +0 -0
  47. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/segment_frames.py +0 -0
  48. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/segment_secs.py +0 -0
  49. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/tts.py +0 -0
  50. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/tts_provider_config.py +0 -0
  51. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/common/types/video.py +0 -0
  52. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/__init__.py +0 -0
  53. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/api_error.py +0 -0
  54. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/datetime_utils.py +0 -0
  55. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/file.py +0 -0
  56. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/http_client.py +0 -0
  57. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/http_response.py +0 -0
  58. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/jsonable_encoder.py +0 -0
  59. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/pydantic_utilities.py +0 -0
  60. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/query_encoder.py +0 -0
  61. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/remove_none_from_dict.py +0 -0
  62. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/request_options.py +0 -0
  63. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/serialization.py +0 -0
  64. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/core/unchecked_base_model.py +0 -0
  65. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/py.typed +0 -0
  66. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/version.py +0 -0
  67. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/webhooks/__init__.py +0 -0
  68. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/webhooks/types/__init__.py +0 -0
  69. {syncsdk-0.1.9 → syncsdk-0.2.0}/src/sync/webhooks/types/webhook_status.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: syncsdk
3
- Version: 0.1.9
3
+ Version: 0.2.0
4
4
  Summary:
5
5
  Requires-Python: >=3.8,<4.0
6
6
  Classifier: Intended Audience :: Developers
@@ -43,7 +43,7 @@ pip install syncsdk
43
43
 
44
44
  ## Reference
45
45
 
46
- A full reference for this library is available [here](./reference.md).
46
+ A full reference for this library is available [here](https://github.com/synchronicity-labs/sync-python-sdk/blob/HEAD/./reference.md).
47
47
 
48
48
  ## Usage
49
49
 
@@ -51,24 +51,12 @@ Instantiate and use the client with the following:
51
51
 
52
52
  ```python
53
53
  from sync import Sync
54
- from sync.common import Audio, GenerationOptions, Video
55
54
 
56
55
  client = Sync(
57
56
  api_key="YOUR_API_KEY",
58
57
  )
59
- client.generations.create(
60
- input=[
61
- Video(
62
- url="https://assets.sync.so/docs/example-video.mp4",
63
- ),
64
- Audio(
65
- url="https://assets.sync.so/docs/example-audio.wav",
66
- ),
67
- ],
68
- model="lipsync-2",
69
- options=GenerationOptions(
70
- sync_mode="loop",
71
- ),
58
+ client.batch.create(
59
+ dry_run=True,
72
60
  )
73
61
  ```
74
62
 
@@ -80,7 +68,6 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
80
68
  import asyncio
81
69
 
82
70
  from sync import AsyncSync
83
- from sync.common import Audio, GenerationOptions, Video
84
71
 
85
72
  client = AsyncSync(
86
73
  api_key="YOUR_API_KEY",
@@ -88,19 +75,8 @@ client = AsyncSync(
88
75
 
89
76
 
90
77
  async def main() -> None:
91
- await client.generations.create(
92
- input=[
93
- Video(
94
- url="https://assets.sync.so/docs/example-video.mp4",
95
- ),
96
- Audio(
97
- url="https://assets.sync.so/docs/example-audio.wav",
98
- ),
99
- ],
100
- model="lipsync-2",
101
- options=GenerationOptions(
102
- sync_mode="loop",
103
- ),
78
+ await client.batch.create(
79
+ dry_run=True,
104
80
  )
105
81
 
106
82
 
@@ -116,7 +92,7 @@ will be thrown.
116
92
  from sync.core.api_error import ApiError
117
93
 
118
94
  try:
119
- client.generations.create(...)
95
+ client.batch.create(...)
120
96
  except ApiError as e:
121
97
  print(e.status_code)
122
98
  print(e.body)
@@ -139,7 +115,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
139
115
  Use the `max_retries` request option to configure this behavior.
140
116
 
141
117
  ```python
142
- client.generations.create(..., request_options={
118
+ client.batch.create(..., request_options={
143
119
  "max_retries": 1
144
120
  })
145
121
  ```
@@ -159,7 +135,7 @@ client = Sync(
159
135
 
160
136
 
161
137
  # Override timeout for a specific method
162
- client.generations.create(..., request_options={
138
+ client.batch.create(..., request_options={
163
139
  "timeout_in_seconds": 1
164
140
  })
165
141
  ```
@@ -17,7 +17,7 @@ pip install syncsdk
17
17
 
18
18
  ## Reference
19
19
 
20
- A full reference for this library is available [here](./reference.md).
20
+ A full reference for this library is available [here](https://github.com/synchronicity-labs/sync-python-sdk/blob/HEAD/./reference.md).
21
21
 
22
22
  ## Usage
23
23
 
@@ -25,24 +25,12 @@ Instantiate and use the client with the following:
25
25
 
26
26
  ```python
27
27
  from sync import Sync
28
- from sync.common import Audio, GenerationOptions, Video
29
28
 
30
29
  client = Sync(
31
30
  api_key="YOUR_API_KEY",
32
31
  )
33
- client.generations.create(
34
- input=[
35
- Video(
36
- url="https://assets.sync.so/docs/example-video.mp4",
37
- ),
38
- Audio(
39
- url="https://assets.sync.so/docs/example-audio.wav",
40
- ),
41
- ],
42
- model="lipsync-2",
43
- options=GenerationOptions(
44
- sync_mode="loop",
45
- ),
32
+ client.batch.create(
33
+ dry_run=True,
46
34
  )
47
35
  ```
48
36
 
@@ -54,7 +42,6 @@ The SDK also exports an `async` client so that you can make non-blocking calls t
54
42
  import asyncio
55
43
 
56
44
  from sync import AsyncSync
57
- from sync.common import Audio, GenerationOptions, Video
58
45
 
59
46
  client = AsyncSync(
60
47
  api_key="YOUR_API_KEY",
@@ -62,19 +49,8 @@ client = AsyncSync(
62
49
 
63
50
 
64
51
  async def main() -> None:
65
- await client.generations.create(
66
- input=[
67
- Video(
68
- url="https://assets.sync.so/docs/example-video.mp4",
69
- ),
70
- Audio(
71
- url="https://assets.sync.so/docs/example-audio.wav",
72
- ),
73
- ],
74
- model="lipsync-2",
75
- options=GenerationOptions(
76
- sync_mode="loop",
77
- ),
52
+ await client.batch.create(
53
+ dry_run=True,
78
54
  )
79
55
 
80
56
 
@@ -90,7 +66,7 @@ will be thrown.
90
66
  from sync.core.api_error import ApiError
91
67
 
92
68
  try:
93
- client.generations.create(...)
69
+ client.batch.create(...)
94
70
  except ApiError as e:
95
71
  print(e.status_code)
96
72
  print(e.body)
@@ -113,7 +89,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
113
89
  Use the `max_retries` request option to configure this behavior.
114
90
 
115
91
  ```python
116
- client.generations.create(..., request_options={
92
+ client.batch.create(..., request_options={
117
93
  "max_retries": 1
118
94
  })
119
95
  ```
@@ -133,7 +109,7 @@ client = Sync(
133
109
 
134
110
 
135
111
  # Override timeout for a specific method
136
- client.generations.create(..., request_options={
112
+ client.batch.create(..., request_options={
137
113
  "timeout_in_seconds": 1
138
114
  })
139
115
  ```
@@ -3,7 +3,7 @@ name = "syncsdk"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "syncsdk"
6
- version = "0.1.9"
6
+ version = "0.2.0"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -1,10 +1,16 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from . import common, generations, webhooks
3
+ from . import batch, common, generations, webhooks
4
4
  from .client import AsyncSync, Sync
5
5
  from .common import (
6
+ ActiveSpeaker,
6
7
  Audio,
7
8
  BadRequestError,
9
+ BatchId,
10
+ BatchMetrics,
11
+ BatchResponse,
12
+ BatchStatus,
13
+ CreateBatchResponse,
8
14
  CreateGenerationDto,
9
15
  ElevenLabs,
10
16
  EstimatedGenerationCost,
@@ -18,12 +24,15 @@ from .common import (
18
24
  InternalServerError,
19
25
  Model,
20
26
  NotFoundError,
27
+ PaymentRequiredError,
21
28
  SegmentFrames,
22
29
  SegmentSecs,
23
30
  SyncMode,
31
+ TooManyRequestsError,
24
32
  Tts,
25
33
  TtsProviderConfig,
26
34
  UnauthorizedError,
35
+ ValidationResponse,
27
36
  Video,
28
37
  )
29
38
  from .environment import SyncEnvironment
@@ -31,9 +40,15 @@ from .version import __version__
31
40
  from .webhooks import GenerationNotification, WebhookStatus
32
41
 
33
42
  __all__ = [
43
+ "ActiveSpeaker",
34
44
  "AsyncSync",
35
45
  "Audio",
36
46
  "BadRequestError",
47
+ "BatchId",
48
+ "BatchMetrics",
49
+ "BatchResponse",
50
+ "BatchStatus",
51
+ "CreateBatchResponse",
37
52
  "CreateGenerationDto",
38
53
  "ElevenLabs",
39
54
  "EstimatedGenerationCost",
@@ -48,17 +63,21 @@ __all__ = [
48
63
  "InternalServerError",
49
64
  "Model",
50
65
  "NotFoundError",
66
+ "PaymentRequiredError",
51
67
  "SegmentFrames",
52
68
  "SegmentSecs",
53
69
  "Sync",
54
70
  "SyncEnvironment",
55
71
  "SyncMode",
72
+ "TooManyRequestsError",
56
73
  "Tts",
57
74
  "TtsProviderConfig",
58
75
  "UnauthorizedError",
76
+ "ValidationResponse",
59
77
  "Video",
60
78
  "WebhookStatus",
61
79
  "__version__",
80
+ "batch",
62
81
  "common",
63
82
  "generations",
64
83
  "webhooks",
@@ -0,0 +1,311 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ..core.client_wrapper import SyncClientWrapper
5
+ from .raw_client import RawBatchClient
6
+ from .. import core
7
+ from ..core.request_options import RequestOptions
8
+ from ..common.types.create_batch_response import CreateBatchResponse
9
+ from ..common.types.batch_id import BatchId
10
+ from ..common.types.batch_response import BatchResponse
11
+ from ..common.types.batch_status import BatchStatus
12
+ import datetime as dt
13
+ from ..core.client_wrapper import AsyncClientWrapper
14
+ from .raw_client import AsyncRawBatchClient
15
+
16
+ # this is used as the default value for optional parameters
17
+ OMIT = typing.cast(typing.Any, ...)
18
+
19
+
20
+ class BatchClient:
21
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
22
+ self._raw_client = RawBatchClient(client_wrapper=client_wrapper)
23
+
24
+ @property
25
+ def with_raw_response(self) -> RawBatchClient:
26
+ """
27
+ Retrieves a raw implementation of this client that returns raw responses.
28
+
29
+ Returns
30
+ -------
31
+ RawBatchClient
32
+ """
33
+ return self._raw_client
34
+
35
+ def create(
36
+ self,
37
+ *,
38
+ input: core.File,
39
+ webhook_url: typing.Optional[str] = OMIT,
40
+ dry_run: typing.Optional[bool] = OMIT,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> CreateBatchResponse:
43
+ """
44
+ API for [Batch Processing](/api-reference/guides/batch-processing). Available only for `Scale` and `Enterprise` plans.
45
+
46
+ Parameters
47
+ ----------
48
+ input : core.File
49
+ See core.File for more documentation
50
+
51
+ webhook_url : typing.Optional[str]
52
+ Optional webhook URL to receive batch completion notifications. A POST request will be sent when the batch completes or fails.
53
+
54
+ dry_run : typing.Optional[bool]
55
+ When true, validates the input file without processing. Returns validation status without creating generations.
56
+
57
+ request_options : typing.Optional[RequestOptions]
58
+ Request-specific configuration.
59
+
60
+ Returns
61
+ -------
62
+ CreateBatchResponse
63
+
64
+ Examples
65
+ --------
66
+ from sync import Sync
67
+
68
+ client = Sync(
69
+ api_key="YOUR_API_KEY",
70
+ )
71
+ client.batch.create(
72
+ webhook_url="https://your-webhook-url.com/batch-webhook",
73
+ dry_run=False,
74
+ )
75
+ """
76
+ response = self._raw_client.create(
77
+ input=input, webhook_url=webhook_url, dry_run=dry_run, request_options=request_options
78
+ )
79
+ return response.data
80
+
81
+ def get(self, id: BatchId, *, request_options: typing.Optional[RequestOptions] = None) -> BatchResponse:
82
+ """
83
+ Retrieve details about a specific batch, including its current status, processing metrics, and output file URL when available.
84
+
85
+ Parameters
86
+ ----------
87
+ id : BatchId
88
+ The unique identifier of the batch
89
+
90
+ request_options : typing.Optional[RequestOptions]
91
+ Request-specific configuration.
92
+
93
+ Returns
94
+ -------
95
+ BatchResponse
96
+
97
+ Examples
98
+ --------
99
+ from sync import Sync
100
+
101
+ client = Sync(
102
+ api_key="YOUR_API_KEY",
103
+ )
104
+ client.batch.get(
105
+ id="batch_abc123",
106
+ )
107
+ """
108
+ response = self._raw_client.get(id, request_options=request_options)
109
+ return response.data
110
+
111
+ def list(
112
+ self,
113
+ *,
114
+ status: typing.Optional[BatchStatus] = None,
115
+ created_after: typing.Optional[dt.datetime] = None,
116
+ created_before: typing.Optional[dt.datetime] = None,
117
+ request_options: typing.Optional[RequestOptions] = None,
118
+ ) -> typing.List[BatchResponse]:
119
+ """
120
+ List all batches for your organization with optional filtering by status and creation date. Results are ordered by creation date (newest first).
121
+
122
+ Parameters
123
+ ----------
124
+ status : typing.Optional[BatchStatus]
125
+ Filter batches by status
126
+
127
+ created_after : typing.Optional[dt.datetime]
128
+ Filter batches created after this datetime (ISO 8601 format)
129
+
130
+ created_before : typing.Optional[dt.datetime]
131
+ Filter batches created before this datetime (ISO 8601 format)
132
+
133
+ request_options : typing.Optional[RequestOptions]
134
+ Request-specific configuration.
135
+
136
+ Returns
137
+ -------
138
+ typing.List[BatchResponse]
139
+
140
+ Examples
141
+ --------
142
+ from sync import Sync
143
+
144
+ client = Sync(
145
+ api_key="YOUR_API_KEY",
146
+ )
147
+ client.batch.list()
148
+ """
149
+ response = self._raw_client.list(
150
+ status=status, created_after=created_after, created_before=created_before, request_options=request_options
151
+ )
152
+ return response.data
153
+
154
+
155
+ class AsyncBatchClient:
156
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
157
+ self._raw_client = AsyncRawBatchClient(client_wrapper=client_wrapper)
158
+
159
+ @property
160
+ def with_raw_response(self) -> AsyncRawBatchClient:
161
+ """
162
+ Retrieves a raw implementation of this client that returns raw responses.
163
+
164
+ Returns
165
+ -------
166
+ AsyncRawBatchClient
167
+ """
168
+ return self._raw_client
169
+
170
+ async def create(
171
+ self,
172
+ *,
173
+ input: core.File,
174
+ webhook_url: typing.Optional[str] = OMIT,
175
+ dry_run: typing.Optional[bool] = OMIT,
176
+ request_options: typing.Optional[RequestOptions] = None,
177
+ ) -> CreateBatchResponse:
178
+ """
179
+ API for [Batch Processing](/api-reference/guides/batch-processing). Available only for `Scale` and `Enterprise` plans.
180
+
181
+ Parameters
182
+ ----------
183
+ input : core.File
184
+ See core.File for more documentation
185
+
186
+ webhook_url : typing.Optional[str]
187
+ Optional webhook URL to receive batch completion notifications. A POST request will be sent when the batch completes or fails.
188
+
189
+ dry_run : typing.Optional[bool]
190
+ When true, validates the input file without processing. Returns validation status without creating generations.
191
+
192
+ request_options : typing.Optional[RequestOptions]
193
+ Request-specific configuration.
194
+
195
+ Returns
196
+ -------
197
+ CreateBatchResponse
198
+
199
+ Examples
200
+ --------
201
+ import asyncio
202
+
203
+ from sync import AsyncSync
204
+
205
+ client = AsyncSync(
206
+ api_key="YOUR_API_KEY",
207
+ )
208
+
209
+
210
+ async def main() -> None:
211
+ await client.batch.create(
212
+ webhook_url="https://your-webhook-url.com/batch-webhook",
213
+ dry_run=False,
214
+ )
215
+
216
+
217
+ asyncio.run(main())
218
+ """
219
+ response = await self._raw_client.create(
220
+ input=input, webhook_url=webhook_url, dry_run=dry_run, request_options=request_options
221
+ )
222
+ return response.data
223
+
224
+ async def get(self, id: BatchId, *, request_options: typing.Optional[RequestOptions] = None) -> BatchResponse:
225
+ """
226
+ Retrieve details about a specific batch, including its current status, processing metrics, and output file URL when available.
227
+
228
+ Parameters
229
+ ----------
230
+ id : BatchId
231
+ The unique identifier of the batch
232
+
233
+ request_options : typing.Optional[RequestOptions]
234
+ Request-specific configuration.
235
+
236
+ Returns
237
+ -------
238
+ BatchResponse
239
+
240
+ Examples
241
+ --------
242
+ import asyncio
243
+
244
+ from sync import AsyncSync
245
+
246
+ client = AsyncSync(
247
+ api_key="YOUR_API_KEY",
248
+ )
249
+
250
+
251
+ async def main() -> None:
252
+ await client.batch.get(
253
+ id="batch_abc123",
254
+ )
255
+
256
+
257
+ asyncio.run(main())
258
+ """
259
+ response = await self._raw_client.get(id, request_options=request_options)
260
+ return response.data
261
+
262
+ async def list(
263
+ self,
264
+ *,
265
+ status: typing.Optional[BatchStatus] = None,
266
+ created_after: typing.Optional[dt.datetime] = None,
267
+ created_before: typing.Optional[dt.datetime] = None,
268
+ request_options: typing.Optional[RequestOptions] = None,
269
+ ) -> typing.List[BatchResponse]:
270
+ """
271
+ List all batches for your organization with optional filtering by status and creation date. Results are ordered by creation date (newest first).
272
+
273
+ Parameters
274
+ ----------
275
+ status : typing.Optional[BatchStatus]
276
+ Filter batches by status
277
+
278
+ created_after : typing.Optional[dt.datetime]
279
+ Filter batches created after this datetime (ISO 8601 format)
280
+
281
+ created_before : typing.Optional[dt.datetime]
282
+ Filter batches created before this datetime (ISO 8601 format)
283
+
284
+ request_options : typing.Optional[RequestOptions]
285
+ Request-specific configuration.
286
+
287
+ Returns
288
+ -------
289
+ typing.List[BatchResponse]
290
+
291
+ Examples
292
+ --------
293
+ import asyncio
294
+
295
+ from sync import AsyncSync
296
+
297
+ client = AsyncSync(
298
+ api_key="YOUR_API_KEY",
299
+ )
300
+
301
+
302
+ async def main() -> None:
303
+ await client.batch.list()
304
+
305
+
306
+ asyncio.run(main())
307
+ """
308
+ response = await self._raw_client.list(
309
+ status=status, created_after=created_after, created_before=created_before, request_options=request_options
310
+ )
311
+ return response.data