syncsdk 0.1.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 (52) hide show
  1. sync/__init__.py +63 -0
  2. sync/client.py +144 -0
  3. sync/common/__init__.py +46 -0
  4. sync/common/errors/__init__.py +8 -0
  5. sync/common/errors/bad_request_error.py +9 -0
  6. sync/common/errors/internal_server_error.py +9 -0
  7. sync/common/errors/not_found_error.py +9 -0
  8. sync/common/errors/unauthorized_error.py +9 -0
  9. sync/common/types/__init__.py +39 -0
  10. sync/common/types/audio.py +27 -0
  11. sync/common/types/create_generation_dto.py +44 -0
  12. sync/common/types/estimated_generation_cost.py +33 -0
  13. sync/common/types/generation.py +77 -0
  14. sync/common/types/generation_error.py +35 -0
  15. sync/common/types/generation_error_message.py +5 -0
  16. sync/common/types/generation_id.py +3 -0
  17. sync/common/types/generation_options.py +28 -0
  18. sync/common/types/generation_status.py +7 -0
  19. sync/common/types/input.py +8 -0
  20. sync/common/types/model.py +7 -0
  21. sync/common/types/segment_frames.py +5 -0
  22. sync/common/types/segment_secs.py +5 -0
  23. sync/common/types/sync_mode.py +5 -0
  24. sync/common/types/tts.py +28 -0
  25. sync/common/types/tts_provider_config.py +34 -0
  26. sync/common/types/video.py +35 -0
  27. sync/core/__init__.py +50 -0
  28. sync/core/api_error.py +15 -0
  29. sync/core/client_wrapper.py +55 -0
  30. sync/core/datetime_utils.py +28 -0
  31. sync/core/file.py +67 -0
  32. sync/core/http_client.py +497 -0
  33. sync/core/http_response.py +47 -0
  34. sync/core/jsonable_encoder.py +100 -0
  35. sync/core/pydantic_utilities.py +294 -0
  36. sync/core/query_encoder.py +58 -0
  37. sync/core/remove_none_from_dict.py +11 -0
  38. sync/core/request_options.py +35 -0
  39. sync/core/serialization.py +276 -0
  40. sync/environment.py +7 -0
  41. sync/generate/__init__.py +2 -0
  42. sync/generate/client.py +446 -0
  43. sync/generate/raw_client.py +648 -0
  44. sync/py.typed +0 -0
  45. sync/version.py +3 -0
  46. sync/webhooks/__init__.py +5 -0
  47. sync/webhooks/types/__init__.py +6 -0
  48. sync/webhooks/types/generation_notification.py +73 -0
  49. sync/webhooks/types/webhook_status.py +5 -0
  50. syncsdk-0.1.0.dist-info/METADATA +190 -0
  51. syncsdk-0.1.0.dist-info/RECORD +52 -0
  52. syncsdk-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,648 @@
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 ..common.types.model import Model
6
+ from ..common.types.input import Input
7
+ from ..common.types.generation_options import GenerationOptions
8
+ from ..core.request_options import RequestOptions
9
+ from ..core.http_response import HttpResponse
10
+ from ..common.types.generation import Generation
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..core.pydantic_utilities import parse_obj_as
13
+ from ..common.errors.bad_request_error import BadRequestError
14
+ from ..common.types.generation_error import GenerationError
15
+ from ..common.errors.unauthorized_error import UnauthorizedError
16
+ from ..common.errors.internal_server_error import InternalServerError
17
+ from json.decoder import JSONDecodeError
18
+ from ..core.api_error import ApiError
19
+ from ..common.types.generation_id import GenerationId
20
+ from ..core.jsonable_encoder import jsonable_encoder
21
+ from ..common.errors.not_found_error import NotFoundError
22
+ from ..common.types.generation_status import GenerationStatus
23
+ from ..common.types.estimated_generation_cost import EstimatedGenerationCost
24
+ from ..core.client_wrapper import AsyncClientWrapper
25
+ from ..core.http_response import AsyncHttpResponse
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
29
+
30
+
31
+ class RawGenerateClient:
32
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
33
+ self._client_wrapper = client_wrapper
34
+
35
+ def create_generation(
36
+ self,
37
+ *,
38
+ model: Model,
39
+ input: typing.Sequence[Input],
40
+ options: typing.Optional[GenerationOptions] = OMIT,
41
+ webhook_url: typing.Optional[str] = OMIT,
42
+ request_options: typing.Optional[RequestOptions] = None,
43
+ ) -> HttpResponse[Generation]:
44
+ """
45
+ Parameters
46
+ ----------
47
+ model : Model
48
+ name of the model to use for generation.
49
+
50
+ input : typing.Sequence[Input]
51
+ Array of input objects. Must include one video input item and one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration.
52
+
53
+ options : typing.Optional[GenerationOptions]
54
+ additional options available for generation.
55
+
56
+ webhook_url : typing.Optional[str]
57
+ webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.
58
+
59
+ request_options : typing.Optional[RequestOptions]
60
+ Request-specific configuration.
61
+
62
+ Returns
63
+ -------
64
+ HttpResponse[Generation]
65
+ Job created successfully
66
+ """
67
+ _response = self._client_wrapper.httpx_client.request(
68
+ "v2/generate",
69
+ method="POST",
70
+ json={
71
+ "model": model,
72
+ "input": convert_and_respect_annotation_metadata(
73
+ object_=input, annotation=typing.Sequence[Input], direction="write"
74
+ ),
75
+ "options": convert_and_respect_annotation_metadata(
76
+ object_=options, annotation=GenerationOptions, direction="write"
77
+ ),
78
+ "webhookUrl": webhook_url,
79
+ },
80
+ request_options=request_options,
81
+ omit=OMIT,
82
+ )
83
+ try:
84
+ if 200 <= _response.status_code < 300:
85
+ _data = typing.cast(
86
+ Generation,
87
+ parse_obj_as(
88
+ type_=Generation, # type: ignore
89
+ object_=_response.json(),
90
+ ),
91
+ )
92
+ return HttpResponse(response=_response, data=_data)
93
+ if _response.status_code == 400:
94
+ raise BadRequestError(
95
+ typing.cast(
96
+ GenerationError,
97
+ parse_obj_as(
98
+ type_=GenerationError, # type: ignore
99
+ object_=_response.json(),
100
+ ),
101
+ )
102
+ )
103
+ if _response.status_code == 401:
104
+ raise UnauthorizedError(
105
+ typing.cast(
106
+ GenerationError,
107
+ parse_obj_as(
108
+ type_=GenerationError, # type: ignore
109
+ object_=_response.json(),
110
+ ),
111
+ )
112
+ )
113
+ if _response.status_code == 500:
114
+ raise InternalServerError(
115
+ typing.cast(
116
+ GenerationError,
117
+ parse_obj_as(
118
+ type_=GenerationError, # type: ignore
119
+ object_=_response.json(),
120
+ ),
121
+ )
122
+ )
123
+ _response_json = _response.json()
124
+ except JSONDecodeError:
125
+ raise ApiError(status_code=_response.status_code, body=_response.text)
126
+ raise ApiError(status_code=_response.status_code, body=_response_json)
127
+
128
+ def get_generation(
129
+ self, id: GenerationId, *, request_options: typing.Optional[RequestOptions] = None
130
+ ) -> HttpResponse[Generation]:
131
+ """
132
+ Parameters
133
+ ----------
134
+ id : GenerationId
135
+
136
+ request_options : typing.Optional[RequestOptions]
137
+ Request-specific configuration.
138
+
139
+ Returns
140
+ -------
141
+ HttpResponse[Generation]
142
+ Job status retrieved successfully
143
+ """
144
+ _response = self._client_wrapper.httpx_client.request(
145
+ f"v2/generate/{jsonable_encoder(id)}",
146
+ method="GET",
147
+ request_options=request_options,
148
+ )
149
+ try:
150
+ if 200 <= _response.status_code < 300:
151
+ _data = typing.cast(
152
+ Generation,
153
+ parse_obj_as(
154
+ type_=Generation, # type: ignore
155
+ object_=_response.json(),
156
+ ),
157
+ )
158
+ return HttpResponse(response=_response, data=_data)
159
+ if _response.status_code == 401:
160
+ raise UnauthorizedError(
161
+ typing.cast(
162
+ GenerationError,
163
+ parse_obj_as(
164
+ type_=GenerationError, # type: ignore
165
+ object_=_response.json(),
166
+ ),
167
+ )
168
+ )
169
+ if _response.status_code == 404:
170
+ raise NotFoundError(
171
+ typing.cast(
172
+ GenerationError,
173
+ parse_obj_as(
174
+ type_=GenerationError, # type: ignore
175
+ object_=_response.json(),
176
+ ),
177
+ )
178
+ )
179
+ if _response.status_code == 500:
180
+ raise InternalServerError(
181
+ typing.cast(
182
+ GenerationError,
183
+ parse_obj_as(
184
+ type_=GenerationError, # type: ignore
185
+ object_=_response.json(),
186
+ ),
187
+ )
188
+ )
189
+ _response_json = _response.json()
190
+ except JSONDecodeError:
191
+ raise ApiError(status_code=_response.status_code, body=_response.text)
192
+ raise ApiError(status_code=_response.status_code, body=_response_json)
193
+
194
+ def list_generations(
195
+ self,
196
+ *,
197
+ status: typing.Optional[GenerationStatus] = None,
198
+ request_options: typing.Optional[RequestOptions] = None,
199
+ ) -> HttpResponse[typing.List[Generation]]:
200
+ """
201
+ Parameters
202
+ ----------
203
+ status : typing.Optional[GenerationStatus]
204
+ Filter generations by status
205
+
206
+ request_options : typing.Optional[RequestOptions]
207
+ Request-specific configuration.
208
+
209
+ Returns
210
+ -------
211
+ HttpResponse[typing.List[Generation]]
212
+ Generations retrieved successfully
213
+ """
214
+ _response = self._client_wrapper.httpx_client.request(
215
+ "v2/generations",
216
+ method="GET",
217
+ params={
218
+ "status": status,
219
+ },
220
+ request_options=request_options,
221
+ )
222
+ try:
223
+ if 200 <= _response.status_code < 300:
224
+ _data = typing.cast(
225
+ typing.List[Generation],
226
+ parse_obj_as(
227
+ type_=typing.List[Generation], # type: ignore
228
+ object_=_response.json(),
229
+ ),
230
+ )
231
+ return HttpResponse(response=_response, data=_data)
232
+ if _response.status_code == 401:
233
+ raise UnauthorizedError(
234
+ typing.cast(
235
+ GenerationError,
236
+ parse_obj_as(
237
+ type_=GenerationError, # type: ignore
238
+ object_=_response.json(),
239
+ ),
240
+ )
241
+ )
242
+ if _response.status_code == 500:
243
+ raise InternalServerError(
244
+ typing.cast(
245
+ GenerationError,
246
+ parse_obj_as(
247
+ type_=GenerationError, # type: ignore
248
+ object_=_response.json(),
249
+ ),
250
+ )
251
+ )
252
+ _response_json = _response.json()
253
+ except JSONDecodeError:
254
+ raise ApiError(status_code=_response.status_code, body=_response.text)
255
+ raise ApiError(status_code=_response.status_code, body=_response_json)
256
+
257
+ def estimate_cost(
258
+ self,
259
+ *,
260
+ model: Model,
261
+ input: typing.Sequence[Input],
262
+ options: typing.Optional[GenerationOptions] = OMIT,
263
+ webhook_url: typing.Optional[str] = OMIT,
264
+ request_options: typing.Optional[RequestOptions] = None,
265
+ ) -> HttpResponse[typing.List[EstimatedGenerationCost]]:
266
+ """
267
+ Parameters
268
+ ----------
269
+ model : Model
270
+ name of the model to use for generation.
271
+
272
+ input : typing.Sequence[Input]
273
+ Array of input objects. Must include one video input item and one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration.
274
+
275
+ options : typing.Optional[GenerationOptions]
276
+ additional options available for generation.
277
+
278
+ webhook_url : typing.Optional[str]
279
+ webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.
280
+
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ HttpResponse[typing.List[EstimatedGenerationCost]]
287
+ Generations retrieved successfully
288
+ """
289
+ _response = self._client_wrapper.httpx_client.request(
290
+ "v2/analyze/cost",
291
+ method="POST",
292
+ json={
293
+ "model": model,
294
+ "input": convert_and_respect_annotation_metadata(
295
+ object_=input, annotation=typing.Sequence[Input], direction="write"
296
+ ),
297
+ "options": convert_and_respect_annotation_metadata(
298
+ object_=options, annotation=GenerationOptions, direction="write"
299
+ ),
300
+ "webhookUrl": webhook_url,
301
+ },
302
+ request_options=request_options,
303
+ omit=OMIT,
304
+ )
305
+ try:
306
+ if 200 <= _response.status_code < 300:
307
+ _data = typing.cast(
308
+ typing.List[EstimatedGenerationCost],
309
+ parse_obj_as(
310
+ type_=typing.List[EstimatedGenerationCost], # type: ignore
311
+ object_=_response.json(),
312
+ ),
313
+ )
314
+ return HttpResponse(response=_response, data=_data)
315
+ if _response.status_code == 401:
316
+ raise UnauthorizedError(
317
+ typing.cast(
318
+ GenerationError,
319
+ parse_obj_as(
320
+ type_=GenerationError, # type: ignore
321
+ object_=_response.json(),
322
+ ),
323
+ )
324
+ )
325
+ if _response.status_code == 500:
326
+ raise InternalServerError(
327
+ typing.cast(
328
+ GenerationError,
329
+ parse_obj_as(
330
+ type_=GenerationError, # type: ignore
331
+ object_=_response.json(),
332
+ ),
333
+ )
334
+ )
335
+ _response_json = _response.json()
336
+ except JSONDecodeError:
337
+ raise ApiError(status_code=_response.status_code, body=_response.text)
338
+ raise ApiError(status_code=_response.status_code, body=_response_json)
339
+
340
+
341
+ class AsyncRawGenerateClient:
342
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
343
+ self._client_wrapper = client_wrapper
344
+
345
+ async def create_generation(
346
+ self,
347
+ *,
348
+ model: Model,
349
+ input: typing.Sequence[Input],
350
+ options: typing.Optional[GenerationOptions] = OMIT,
351
+ webhook_url: typing.Optional[str] = OMIT,
352
+ request_options: typing.Optional[RequestOptions] = None,
353
+ ) -> AsyncHttpResponse[Generation]:
354
+ """
355
+ Parameters
356
+ ----------
357
+ model : Model
358
+ name of the model to use for generation.
359
+
360
+ input : typing.Sequence[Input]
361
+ Array of input objects. Must include one video input item and one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration.
362
+
363
+ options : typing.Optional[GenerationOptions]
364
+ additional options available for generation.
365
+
366
+ webhook_url : typing.Optional[str]
367
+ webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.
368
+
369
+ request_options : typing.Optional[RequestOptions]
370
+ Request-specific configuration.
371
+
372
+ Returns
373
+ -------
374
+ AsyncHttpResponse[Generation]
375
+ Job created successfully
376
+ """
377
+ _response = await self._client_wrapper.httpx_client.request(
378
+ "v2/generate",
379
+ method="POST",
380
+ json={
381
+ "model": model,
382
+ "input": convert_and_respect_annotation_metadata(
383
+ object_=input, annotation=typing.Sequence[Input], direction="write"
384
+ ),
385
+ "options": convert_and_respect_annotation_metadata(
386
+ object_=options, annotation=GenerationOptions, direction="write"
387
+ ),
388
+ "webhookUrl": webhook_url,
389
+ },
390
+ request_options=request_options,
391
+ omit=OMIT,
392
+ )
393
+ try:
394
+ if 200 <= _response.status_code < 300:
395
+ _data = typing.cast(
396
+ Generation,
397
+ parse_obj_as(
398
+ type_=Generation, # type: ignore
399
+ object_=_response.json(),
400
+ ),
401
+ )
402
+ return AsyncHttpResponse(response=_response, data=_data)
403
+ if _response.status_code == 400:
404
+ raise BadRequestError(
405
+ typing.cast(
406
+ GenerationError,
407
+ parse_obj_as(
408
+ type_=GenerationError, # type: ignore
409
+ object_=_response.json(),
410
+ ),
411
+ )
412
+ )
413
+ if _response.status_code == 401:
414
+ raise UnauthorizedError(
415
+ typing.cast(
416
+ GenerationError,
417
+ parse_obj_as(
418
+ type_=GenerationError, # type: ignore
419
+ object_=_response.json(),
420
+ ),
421
+ )
422
+ )
423
+ if _response.status_code == 500:
424
+ raise InternalServerError(
425
+ typing.cast(
426
+ GenerationError,
427
+ parse_obj_as(
428
+ type_=GenerationError, # type: ignore
429
+ object_=_response.json(),
430
+ ),
431
+ )
432
+ )
433
+ _response_json = _response.json()
434
+ except JSONDecodeError:
435
+ raise ApiError(status_code=_response.status_code, body=_response.text)
436
+ raise ApiError(status_code=_response.status_code, body=_response_json)
437
+
438
+ async def get_generation(
439
+ self, id: GenerationId, *, request_options: typing.Optional[RequestOptions] = None
440
+ ) -> AsyncHttpResponse[Generation]:
441
+ """
442
+ Parameters
443
+ ----------
444
+ id : GenerationId
445
+
446
+ request_options : typing.Optional[RequestOptions]
447
+ Request-specific configuration.
448
+
449
+ Returns
450
+ -------
451
+ AsyncHttpResponse[Generation]
452
+ Job status retrieved successfully
453
+ """
454
+ _response = await self._client_wrapper.httpx_client.request(
455
+ f"v2/generate/{jsonable_encoder(id)}",
456
+ method="GET",
457
+ request_options=request_options,
458
+ )
459
+ try:
460
+ if 200 <= _response.status_code < 300:
461
+ _data = typing.cast(
462
+ Generation,
463
+ parse_obj_as(
464
+ type_=Generation, # type: ignore
465
+ object_=_response.json(),
466
+ ),
467
+ )
468
+ return AsyncHttpResponse(response=_response, data=_data)
469
+ if _response.status_code == 401:
470
+ raise UnauthorizedError(
471
+ typing.cast(
472
+ GenerationError,
473
+ parse_obj_as(
474
+ type_=GenerationError, # type: ignore
475
+ object_=_response.json(),
476
+ ),
477
+ )
478
+ )
479
+ if _response.status_code == 404:
480
+ raise NotFoundError(
481
+ typing.cast(
482
+ GenerationError,
483
+ parse_obj_as(
484
+ type_=GenerationError, # type: ignore
485
+ object_=_response.json(),
486
+ ),
487
+ )
488
+ )
489
+ if _response.status_code == 500:
490
+ raise InternalServerError(
491
+ typing.cast(
492
+ GenerationError,
493
+ parse_obj_as(
494
+ type_=GenerationError, # type: ignore
495
+ object_=_response.json(),
496
+ ),
497
+ )
498
+ )
499
+ _response_json = _response.json()
500
+ except JSONDecodeError:
501
+ raise ApiError(status_code=_response.status_code, body=_response.text)
502
+ raise ApiError(status_code=_response.status_code, body=_response_json)
503
+
504
+ async def list_generations(
505
+ self,
506
+ *,
507
+ status: typing.Optional[GenerationStatus] = None,
508
+ request_options: typing.Optional[RequestOptions] = None,
509
+ ) -> AsyncHttpResponse[typing.List[Generation]]:
510
+ """
511
+ Parameters
512
+ ----------
513
+ status : typing.Optional[GenerationStatus]
514
+ Filter generations by status
515
+
516
+ request_options : typing.Optional[RequestOptions]
517
+ Request-specific configuration.
518
+
519
+ Returns
520
+ -------
521
+ AsyncHttpResponse[typing.List[Generation]]
522
+ Generations retrieved successfully
523
+ """
524
+ _response = await self._client_wrapper.httpx_client.request(
525
+ "v2/generations",
526
+ method="GET",
527
+ params={
528
+ "status": status,
529
+ },
530
+ request_options=request_options,
531
+ )
532
+ try:
533
+ if 200 <= _response.status_code < 300:
534
+ _data = typing.cast(
535
+ typing.List[Generation],
536
+ parse_obj_as(
537
+ type_=typing.List[Generation], # type: ignore
538
+ object_=_response.json(),
539
+ ),
540
+ )
541
+ return AsyncHttpResponse(response=_response, data=_data)
542
+ if _response.status_code == 401:
543
+ raise UnauthorizedError(
544
+ typing.cast(
545
+ GenerationError,
546
+ parse_obj_as(
547
+ type_=GenerationError, # type: ignore
548
+ object_=_response.json(),
549
+ ),
550
+ )
551
+ )
552
+ if _response.status_code == 500:
553
+ raise InternalServerError(
554
+ typing.cast(
555
+ GenerationError,
556
+ parse_obj_as(
557
+ type_=GenerationError, # type: ignore
558
+ object_=_response.json(),
559
+ ),
560
+ )
561
+ )
562
+ _response_json = _response.json()
563
+ except JSONDecodeError:
564
+ raise ApiError(status_code=_response.status_code, body=_response.text)
565
+ raise ApiError(status_code=_response.status_code, body=_response_json)
566
+
567
+ async def estimate_cost(
568
+ self,
569
+ *,
570
+ model: Model,
571
+ input: typing.Sequence[Input],
572
+ options: typing.Optional[GenerationOptions] = OMIT,
573
+ webhook_url: typing.Optional[str] = OMIT,
574
+ request_options: typing.Optional[RequestOptions] = None,
575
+ ) -> AsyncHttpResponse[typing.List[EstimatedGenerationCost]]:
576
+ """
577
+ Parameters
578
+ ----------
579
+ model : Model
580
+ name of the model to use for generation.
581
+
582
+ input : typing.Sequence[Input]
583
+ Array of input objects. Must include one video input item and one audio input item. Audio input items can be provided as either: recorded/captured audio url or a text-to-speech input with tts provider configuration.
584
+
585
+ options : typing.Optional[GenerationOptions]
586
+ additional options available for generation.
587
+
588
+ webhook_url : typing.Optional[str]
589
+ webhook url for generation status updates. once the generation completes we will send a POST request to the webhook url with the generation data.
590
+
591
+ request_options : typing.Optional[RequestOptions]
592
+ Request-specific configuration.
593
+
594
+ Returns
595
+ -------
596
+ AsyncHttpResponse[typing.List[EstimatedGenerationCost]]
597
+ Generations retrieved successfully
598
+ """
599
+ _response = await self._client_wrapper.httpx_client.request(
600
+ "v2/analyze/cost",
601
+ method="POST",
602
+ json={
603
+ "model": model,
604
+ "input": convert_and_respect_annotation_metadata(
605
+ object_=input, annotation=typing.Sequence[Input], direction="write"
606
+ ),
607
+ "options": convert_and_respect_annotation_metadata(
608
+ object_=options, annotation=GenerationOptions, direction="write"
609
+ ),
610
+ "webhookUrl": webhook_url,
611
+ },
612
+ request_options=request_options,
613
+ omit=OMIT,
614
+ )
615
+ try:
616
+ if 200 <= _response.status_code < 300:
617
+ _data = typing.cast(
618
+ typing.List[EstimatedGenerationCost],
619
+ parse_obj_as(
620
+ type_=typing.List[EstimatedGenerationCost], # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ )
624
+ return AsyncHttpResponse(response=_response, data=_data)
625
+ if _response.status_code == 401:
626
+ raise UnauthorizedError(
627
+ typing.cast(
628
+ GenerationError,
629
+ parse_obj_as(
630
+ type_=GenerationError, # type: ignore
631
+ object_=_response.json(),
632
+ ),
633
+ )
634
+ )
635
+ if _response.status_code == 500:
636
+ raise InternalServerError(
637
+ typing.cast(
638
+ GenerationError,
639
+ parse_obj_as(
640
+ type_=GenerationError, # type: ignore
641
+ object_=_response.json(),
642
+ ),
643
+ )
644
+ )
645
+ _response_json = _response.json()
646
+ except JSONDecodeError:
647
+ raise ApiError(status_code=_response.status_code, body=_response.text)
648
+ raise ApiError(status_code=_response.status_code, body=_response_json)
sync/py.typed ADDED
File without changes
sync/version.py ADDED
@@ -0,0 +1,3 @@
1
+ from importlib import metadata
2
+
3
+ __version__ = metadata.version("syncsdk")
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import GenerationNotification, WebhookStatus
4
+
5
+ __all__ = ["GenerationNotification", "WebhookStatus"]
@@ -0,0 +1,6 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .generation_notification import GenerationNotification
4
+ from .webhook_status import WebhookStatus
5
+
6
+ __all__ = ["GenerationNotification", "WebhookStatus"]