murf 1.0.2__py3-none-any.whl → 1.1.1__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.

Potentially problematic release.


This version of murf might be problematic. Click here for more details.

Files changed (36) hide show
  1. murf/__init__.py +28 -1
  2. murf/base_client.py +4 -0
  3. murf/client.py +3 -1
  4. murf/core/client_wrapper.py +1 -1
  5. murf/dubbing/__init__.py +14 -0
  6. murf/dubbing/client.py +26 -0
  7. murf/dubbing/jobs/__init__.py +5 -0
  8. murf/dubbing/jobs/client.py +712 -0
  9. murf/dubbing/jobs/types/__init__.py +6 -0
  10. murf/dubbing/jobs/types/jobs_create_request_priority.py +5 -0
  11. murf/dubbing/jobs/types/jobs_create_with_project_id_request_priority.py +5 -0
  12. murf/dubbing/languages/__init__.py +2 -0
  13. murf/dubbing/languages/client.py +369 -0
  14. murf/dubbing/projects/__init__.py +5 -0
  15. murf/dubbing/projects/client.py +682 -0
  16. murf/dubbing/projects/types/__init__.py +5 -0
  17. murf/dubbing/projects/types/api_create_project_request_dubbing_type.py +5 -0
  18. murf/dubbing_client.py +120 -0
  19. murf/types/__init__.py +24 -0
  20. murf/types/api_job_response.py +53 -0
  21. murf/types/api_job_response_dubbing_type.py +5 -0
  22. murf/types/api_job_response_priority.py +5 -0
  23. murf/types/api_project_response.py +44 -0
  24. murf/types/api_project_response_dubbing_type.py +5 -0
  25. murf/types/dub_api_detail_response.py +23 -0
  26. murf/types/dub_job_status_response.py +39 -0
  27. murf/types/form_data_content_disposition.py +31 -0
  28. murf/types/group_api_project_response.py +24 -0
  29. murf/types/locale_response.py +25 -0
  30. murf/types/locale_response_supports_item.py +5 -0
  31. murf/types/source_locale_response.py +20 -0
  32. {murf-1.0.2.dist-info → murf-1.1.1.dist-info}/METADATA +65 -15
  33. murf-1.1.1.dist-info/RECORD +70 -0
  34. murf-1.0.2.dist-info/RECORD +0 -44
  35. {murf-1.0.2.dist-info → murf-1.1.1.dist-info}/LICENSE +0 -0
  36. {murf-1.0.2.dist-info → murf-1.1.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,712 @@
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 .types.jobs_create_request_priority import JobsCreateRequestPriority
6
+ from ... import core
7
+ from ...core.request_options import RequestOptions
8
+ from ...types.api_job_response import ApiJobResponse
9
+ from ...core.pydantic_utilities import parse_obj_as
10
+ from ...errors.bad_request_error import BadRequestError
11
+ from ...errors.forbidden_error import ForbiddenError
12
+ from ...errors.internal_server_error import InternalServerError
13
+ from ...errors.service_unavailable_error import ServiceUnavailableError
14
+ from json.decoder import JSONDecodeError
15
+ from ...core.api_error import ApiError
16
+ from .types.jobs_create_with_project_id_request_priority import JobsCreateWithProjectIdRequestPriority
17
+ from ...types.dub_job_status_response import DubJobStatusResponse
18
+ from ...core.jsonable_encoder import jsonable_encoder
19
+ from ...core.client_wrapper import AsyncClientWrapper
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class JobsClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def create(
30
+ self,
31
+ *,
32
+ target_locales: typing.List[str],
33
+ priority: JobsCreateRequestPriority,
34
+ file: typing.Optional[core.File] = OMIT,
35
+ file_url: typing.Optional[str] = OMIT,
36
+ source_locale: typing.Optional[str] = OMIT,
37
+ webhook_url: typing.Optional[str] = OMIT,
38
+ file_name: typing.Optional[str] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> ApiJobResponse:
41
+ """
42
+ Parameters
43
+ ----------
44
+ target_locales : typing.List[str]
45
+ List of target locales
46
+
47
+ priority : JobsCreateRequestPriority
48
+ Priority of the job. Allowed values: LOW, NORMAL, HIGH
49
+
50
+ file : typing.Optional[core.File]
51
+ See core.File for more documentation
52
+
53
+ file_url : typing.Optional[str]
54
+
55
+ source_locale : typing.Optional[str]
56
+ Source locale
57
+
58
+ webhook_url : typing.Optional[str]
59
+
60
+ file_name : typing.Optional[str]
61
+
62
+ request_options : typing.Optional[RequestOptions]
63
+ Request-specific configuration.
64
+
65
+ Returns
66
+ -------
67
+ ApiJobResponse
68
+ Ok
69
+
70
+ Examples
71
+ --------
72
+ from murf import Murf
73
+
74
+ client = Murf(
75
+ api_key="YOUR_API_KEY",
76
+ )
77
+ client.dubbing.jobs.create(
78
+ target_locales=["target_locales"],
79
+ priority="LOW",
80
+ )
81
+ """
82
+ _response = self._client_wrapper.httpx_client.request(
83
+ "v1/murfdub/jobs/create",
84
+ method="POST",
85
+ data={
86
+ "file_url": file_url,
87
+ "source_locale": source_locale,
88
+ "target_locales": target_locales,
89
+ "webhook_url": webhook_url,
90
+ "file_name": file_name,
91
+ "priority": priority,
92
+ },
93
+ files={
94
+ "file": file,
95
+ },
96
+ request_options=request_options,
97
+ omit=OMIT,
98
+ )
99
+ try:
100
+ if 200 <= _response.status_code < 300:
101
+ return typing.cast(
102
+ ApiJobResponse,
103
+ parse_obj_as(
104
+ type_=ApiJobResponse, # type: ignore
105
+ object_=_response.json(),
106
+ ),
107
+ )
108
+ if _response.status_code == 400:
109
+ raise BadRequestError(
110
+ typing.cast(
111
+ typing.Optional[typing.Any],
112
+ parse_obj_as(
113
+ type_=typing.Optional[typing.Any], # type: ignore
114
+ object_=_response.json(),
115
+ ),
116
+ )
117
+ )
118
+ if _response.status_code == 403:
119
+ raise ForbiddenError(
120
+ typing.cast(
121
+ typing.Optional[typing.Any],
122
+ parse_obj_as(
123
+ type_=typing.Optional[typing.Any], # type: ignore
124
+ object_=_response.json(),
125
+ ),
126
+ )
127
+ )
128
+ if _response.status_code == 500:
129
+ raise InternalServerError(
130
+ typing.cast(
131
+ typing.Optional[typing.Any],
132
+ parse_obj_as(
133
+ type_=typing.Optional[typing.Any], # type: ignore
134
+ object_=_response.json(),
135
+ ),
136
+ )
137
+ )
138
+ if _response.status_code == 503:
139
+ raise ServiceUnavailableError(
140
+ typing.cast(
141
+ typing.Optional[typing.Any],
142
+ parse_obj_as(
143
+ type_=typing.Optional[typing.Any], # type: ignore
144
+ object_=_response.json(),
145
+ ),
146
+ )
147
+ )
148
+ _response_json = _response.json()
149
+ except JSONDecodeError:
150
+ raise ApiError(status_code=_response.status_code, body=_response.text)
151
+ raise ApiError(status_code=_response.status_code, body=_response_json)
152
+
153
+ def create_with_project_id(
154
+ self,
155
+ *,
156
+ project_id: str,
157
+ file: typing.Optional[core.File] = OMIT,
158
+ file_url: typing.Optional[str] = OMIT,
159
+ webhook_url: typing.Optional[str] = OMIT,
160
+ file_name: typing.Optional[str] = OMIT,
161
+ priority: typing.Optional[JobsCreateWithProjectIdRequestPriority] = OMIT,
162
+ request_options: typing.Optional[RequestOptions] = None,
163
+ ) -> ApiJobResponse:
164
+ """
165
+ Parameters
166
+ ----------
167
+ project_id : str
168
+ Your Project Id
169
+
170
+ file : typing.Optional[core.File]
171
+ See core.File for more documentation
172
+
173
+ file_url : typing.Optional[str]
174
+
175
+ webhook_url : typing.Optional[str]
176
+
177
+ file_name : typing.Optional[str]
178
+
179
+ priority : typing.Optional[JobsCreateWithProjectIdRequestPriority]
180
+ Priority of the job. Allowed values: LOW, NORMAL, HIGH
181
+
182
+ request_options : typing.Optional[RequestOptions]
183
+ Request-specific configuration.
184
+
185
+ Returns
186
+ -------
187
+ ApiJobResponse
188
+ Ok
189
+
190
+ Examples
191
+ --------
192
+ from murf import Murf
193
+
194
+ client = Murf(
195
+ api_key="YOUR_API_KEY",
196
+ )
197
+ client.dubbing.jobs.create_with_project_id(
198
+ project_id="project_id",
199
+ )
200
+ """
201
+ _response = self._client_wrapper.httpx_client.request(
202
+ "v1/murfdub/jobs/create-with-project-id",
203
+ method="POST",
204
+ data={
205
+ "file_url": file_url,
206
+ "project_id": project_id,
207
+ "webhook_url": webhook_url,
208
+ "file_name": file_name,
209
+ "priority": priority,
210
+ },
211
+ files={
212
+ "file": file,
213
+ },
214
+ request_options=request_options,
215
+ omit=OMIT,
216
+ )
217
+ try:
218
+ if 200 <= _response.status_code < 300:
219
+ return typing.cast(
220
+ ApiJobResponse,
221
+ parse_obj_as(
222
+ type_=ApiJobResponse, # type: ignore
223
+ object_=_response.json(),
224
+ ),
225
+ )
226
+ if _response.status_code == 400:
227
+ raise BadRequestError(
228
+ typing.cast(
229
+ typing.Optional[typing.Any],
230
+ parse_obj_as(
231
+ type_=typing.Optional[typing.Any], # type: ignore
232
+ object_=_response.json(),
233
+ ),
234
+ )
235
+ )
236
+ if _response.status_code == 403:
237
+ raise ForbiddenError(
238
+ typing.cast(
239
+ typing.Optional[typing.Any],
240
+ parse_obj_as(
241
+ type_=typing.Optional[typing.Any], # type: ignore
242
+ object_=_response.json(),
243
+ ),
244
+ )
245
+ )
246
+ if _response.status_code == 500:
247
+ raise InternalServerError(
248
+ typing.cast(
249
+ typing.Optional[typing.Any],
250
+ parse_obj_as(
251
+ type_=typing.Optional[typing.Any], # type: ignore
252
+ object_=_response.json(),
253
+ ),
254
+ )
255
+ )
256
+ if _response.status_code == 503:
257
+ raise ServiceUnavailableError(
258
+ typing.cast(
259
+ typing.Optional[typing.Any],
260
+ parse_obj_as(
261
+ type_=typing.Optional[typing.Any], # type: ignore
262
+ object_=_response.json(),
263
+ ),
264
+ )
265
+ )
266
+ _response_json = _response.json()
267
+ except JSONDecodeError:
268
+ raise ApiError(status_code=_response.status_code, body=_response.text)
269
+ raise ApiError(status_code=_response.status_code, body=_response_json)
270
+
271
+ def get_status(
272
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
273
+ ) -> DubJobStatusResponse:
274
+ """
275
+ Parameters
276
+ ----------
277
+ job_id : str
278
+
279
+ request_options : typing.Optional[RequestOptions]
280
+ Request-specific configuration.
281
+
282
+ Returns
283
+ -------
284
+ DubJobStatusResponse
285
+ Ok
286
+
287
+ Examples
288
+ --------
289
+ from murf import Murf
290
+
291
+ client = Murf(
292
+ api_key="YOUR_API_KEY",
293
+ )
294
+ client.dubbing.jobs.get_status(
295
+ job_id="job_id",
296
+ )
297
+ """
298
+ _response = self._client_wrapper.httpx_client.request(
299
+ f"v1/murfdub/jobs/{jsonable_encoder(job_id)}/status",
300
+ method="GET",
301
+ request_options=request_options,
302
+ )
303
+ try:
304
+ if 200 <= _response.status_code < 300:
305
+ return typing.cast(
306
+ DubJobStatusResponse,
307
+ parse_obj_as(
308
+ type_=DubJobStatusResponse, # type: ignore
309
+ object_=_response.json(),
310
+ ),
311
+ )
312
+ if _response.status_code == 400:
313
+ raise BadRequestError(
314
+ typing.cast(
315
+ typing.Optional[typing.Any],
316
+ parse_obj_as(
317
+ type_=typing.Optional[typing.Any], # type: ignore
318
+ object_=_response.json(),
319
+ ),
320
+ )
321
+ )
322
+ if _response.status_code == 403:
323
+ raise ForbiddenError(
324
+ typing.cast(
325
+ typing.Optional[typing.Any],
326
+ parse_obj_as(
327
+ type_=typing.Optional[typing.Any], # type: ignore
328
+ object_=_response.json(),
329
+ ),
330
+ )
331
+ )
332
+ if _response.status_code == 500:
333
+ raise InternalServerError(
334
+ typing.cast(
335
+ typing.Optional[typing.Any],
336
+ parse_obj_as(
337
+ type_=typing.Optional[typing.Any], # type: ignore
338
+ object_=_response.json(),
339
+ ),
340
+ )
341
+ )
342
+ if _response.status_code == 503:
343
+ raise ServiceUnavailableError(
344
+ typing.cast(
345
+ typing.Optional[typing.Any],
346
+ parse_obj_as(
347
+ type_=typing.Optional[typing.Any], # type: ignore
348
+ object_=_response.json(),
349
+ ),
350
+ )
351
+ )
352
+ _response_json = _response.json()
353
+ except JSONDecodeError:
354
+ raise ApiError(status_code=_response.status_code, body=_response.text)
355
+ raise ApiError(status_code=_response.status_code, body=_response_json)
356
+
357
+
358
+ class AsyncJobsClient:
359
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
360
+ self._client_wrapper = client_wrapper
361
+
362
+ async def create(
363
+ self,
364
+ *,
365
+ target_locales: typing.List[str],
366
+ priority: JobsCreateRequestPriority,
367
+ file: typing.Optional[core.File] = OMIT,
368
+ file_url: typing.Optional[str] = OMIT,
369
+ source_locale: typing.Optional[str] = OMIT,
370
+ webhook_url: typing.Optional[str] = OMIT,
371
+ file_name: typing.Optional[str] = OMIT,
372
+ request_options: typing.Optional[RequestOptions] = None,
373
+ ) -> ApiJobResponse:
374
+ """
375
+ Parameters
376
+ ----------
377
+ target_locales : typing.List[str]
378
+ List of target locales
379
+
380
+ priority : JobsCreateRequestPriority
381
+ Priority of the job. Allowed values: LOW, NORMAL, HIGH
382
+
383
+ file : typing.Optional[core.File]
384
+ See core.File for more documentation
385
+
386
+ file_url : typing.Optional[str]
387
+
388
+ source_locale : typing.Optional[str]
389
+ Source locale
390
+
391
+ webhook_url : typing.Optional[str]
392
+
393
+ file_name : typing.Optional[str]
394
+
395
+ request_options : typing.Optional[RequestOptions]
396
+ Request-specific configuration.
397
+
398
+ Returns
399
+ -------
400
+ ApiJobResponse
401
+ Ok
402
+
403
+ Examples
404
+ --------
405
+ import asyncio
406
+
407
+ from murf import AsyncMurf
408
+
409
+ client = AsyncMurf(
410
+ api_key="YOUR_API_KEY",
411
+ )
412
+
413
+
414
+ async def main() -> None:
415
+ await client.dubbing.jobs.create(
416
+ target_locales=["target_locales"],
417
+ priority="LOW",
418
+ )
419
+
420
+
421
+ asyncio.run(main())
422
+ """
423
+ _response = await self._client_wrapper.httpx_client.request(
424
+ "v1/murfdub/jobs/create",
425
+ method="POST",
426
+ data={
427
+ "file_url": file_url,
428
+ "source_locale": source_locale,
429
+ "target_locales": target_locales,
430
+ "webhook_url": webhook_url,
431
+ "file_name": file_name,
432
+ "priority": priority,
433
+ },
434
+ files={
435
+ "file": file,
436
+ },
437
+ request_options=request_options,
438
+ omit=OMIT,
439
+ )
440
+ try:
441
+ if 200 <= _response.status_code < 300:
442
+ return typing.cast(
443
+ ApiJobResponse,
444
+ parse_obj_as(
445
+ type_=ApiJobResponse, # type: ignore
446
+ object_=_response.json(),
447
+ ),
448
+ )
449
+ if _response.status_code == 400:
450
+ raise BadRequestError(
451
+ typing.cast(
452
+ typing.Optional[typing.Any],
453
+ parse_obj_as(
454
+ type_=typing.Optional[typing.Any], # type: ignore
455
+ object_=_response.json(),
456
+ ),
457
+ )
458
+ )
459
+ if _response.status_code == 403:
460
+ raise ForbiddenError(
461
+ typing.cast(
462
+ typing.Optional[typing.Any],
463
+ parse_obj_as(
464
+ type_=typing.Optional[typing.Any], # type: ignore
465
+ object_=_response.json(),
466
+ ),
467
+ )
468
+ )
469
+ if _response.status_code == 500:
470
+ raise InternalServerError(
471
+ typing.cast(
472
+ typing.Optional[typing.Any],
473
+ parse_obj_as(
474
+ type_=typing.Optional[typing.Any], # type: ignore
475
+ object_=_response.json(),
476
+ ),
477
+ )
478
+ )
479
+ if _response.status_code == 503:
480
+ raise ServiceUnavailableError(
481
+ typing.cast(
482
+ typing.Optional[typing.Any],
483
+ parse_obj_as(
484
+ type_=typing.Optional[typing.Any], # type: ignore
485
+ object_=_response.json(),
486
+ ),
487
+ )
488
+ )
489
+ _response_json = _response.json()
490
+ except JSONDecodeError:
491
+ raise ApiError(status_code=_response.status_code, body=_response.text)
492
+ raise ApiError(status_code=_response.status_code, body=_response_json)
493
+
494
+ async def create_with_project_id(
495
+ self,
496
+ *,
497
+ project_id: str,
498
+ file: typing.Optional[core.File] = OMIT,
499
+ file_url: typing.Optional[str] = OMIT,
500
+ webhook_url: typing.Optional[str] = OMIT,
501
+ file_name: typing.Optional[str] = OMIT,
502
+ priority: typing.Optional[JobsCreateWithProjectIdRequestPriority] = OMIT,
503
+ request_options: typing.Optional[RequestOptions] = None,
504
+ ) -> ApiJobResponse:
505
+ """
506
+ Parameters
507
+ ----------
508
+ project_id : str
509
+ Your Project Id
510
+
511
+ file : typing.Optional[core.File]
512
+ See core.File for more documentation
513
+
514
+ file_url : typing.Optional[str]
515
+
516
+ webhook_url : typing.Optional[str]
517
+
518
+ file_name : typing.Optional[str]
519
+
520
+ priority : typing.Optional[JobsCreateWithProjectIdRequestPriority]
521
+ Priority of the job. Allowed values: LOW, NORMAL, HIGH
522
+
523
+ request_options : typing.Optional[RequestOptions]
524
+ Request-specific configuration.
525
+
526
+ Returns
527
+ -------
528
+ ApiJobResponse
529
+ Ok
530
+
531
+ Examples
532
+ --------
533
+ import asyncio
534
+
535
+ from murf import AsyncMurf
536
+
537
+ client = AsyncMurf(
538
+ api_key="YOUR_API_KEY",
539
+ )
540
+
541
+
542
+ async def main() -> None:
543
+ await client.dubbing.jobs.create_with_project_id(
544
+ project_id="project_id",
545
+ )
546
+
547
+
548
+ asyncio.run(main())
549
+ """
550
+ _response = await self._client_wrapper.httpx_client.request(
551
+ "v1/murfdub/jobs/create-with-project-id",
552
+ method="POST",
553
+ data={
554
+ "file_url": file_url,
555
+ "project_id": project_id,
556
+ "webhook_url": webhook_url,
557
+ "file_name": file_name,
558
+ "priority": priority,
559
+ },
560
+ files={
561
+ "file": file,
562
+ },
563
+ request_options=request_options,
564
+ omit=OMIT,
565
+ )
566
+ try:
567
+ if 200 <= _response.status_code < 300:
568
+ return typing.cast(
569
+ ApiJobResponse,
570
+ parse_obj_as(
571
+ type_=ApiJobResponse, # type: ignore
572
+ object_=_response.json(),
573
+ ),
574
+ )
575
+ if _response.status_code == 400:
576
+ raise BadRequestError(
577
+ typing.cast(
578
+ typing.Optional[typing.Any],
579
+ parse_obj_as(
580
+ type_=typing.Optional[typing.Any], # type: ignore
581
+ object_=_response.json(),
582
+ ),
583
+ )
584
+ )
585
+ if _response.status_code == 403:
586
+ raise ForbiddenError(
587
+ typing.cast(
588
+ typing.Optional[typing.Any],
589
+ parse_obj_as(
590
+ type_=typing.Optional[typing.Any], # type: ignore
591
+ object_=_response.json(),
592
+ ),
593
+ )
594
+ )
595
+ if _response.status_code == 500:
596
+ raise InternalServerError(
597
+ typing.cast(
598
+ typing.Optional[typing.Any],
599
+ parse_obj_as(
600
+ type_=typing.Optional[typing.Any], # type: ignore
601
+ object_=_response.json(),
602
+ ),
603
+ )
604
+ )
605
+ if _response.status_code == 503:
606
+ raise ServiceUnavailableError(
607
+ typing.cast(
608
+ typing.Optional[typing.Any],
609
+ parse_obj_as(
610
+ type_=typing.Optional[typing.Any], # type: ignore
611
+ object_=_response.json(),
612
+ ),
613
+ )
614
+ )
615
+ _response_json = _response.json()
616
+ except JSONDecodeError:
617
+ raise ApiError(status_code=_response.status_code, body=_response.text)
618
+ raise ApiError(status_code=_response.status_code, body=_response_json)
619
+
620
+ async def get_status(
621
+ self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None
622
+ ) -> DubJobStatusResponse:
623
+ """
624
+ Parameters
625
+ ----------
626
+ job_id : str
627
+
628
+ request_options : typing.Optional[RequestOptions]
629
+ Request-specific configuration.
630
+
631
+ Returns
632
+ -------
633
+ DubJobStatusResponse
634
+ Ok
635
+
636
+ Examples
637
+ --------
638
+ import asyncio
639
+
640
+ from murf import AsyncMurf
641
+
642
+ client = AsyncMurf(
643
+ api_key="YOUR_API_KEY",
644
+ )
645
+
646
+
647
+ async def main() -> None:
648
+ await client.dubbing.jobs.get_status(
649
+ job_id="job_id",
650
+ )
651
+
652
+
653
+ asyncio.run(main())
654
+ """
655
+ _response = await self._client_wrapper.httpx_client.request(
656
+ f"v1/murfdub/jobs/{jsonable_encoder(job_id)}/status",
657
+ method="GET",
658
+ request_options=request_options,
659
+ )
660
+ try:
661
+ if 200 <= _response.status_code < 300:
662
+ return typing.cast(
663
+ DubJobStatusResponse,
664
+ parse_obj_as(
665
+ type_=DubJobStatusResponse, # type: ignore
666
+ object_=_response.json(),
667
+ ),
668
+ )
669
+ if _response.status_code == 400:
670
+ raise BadRequestError(
671
+ typing.cast(
672
+ typing.Optional[typing.Any],
673
+ parse_obj_as(
674
+ type_=typing.Optional[typing.Any], # type: ignore
675
+ object_=_response.json(),
676
+ ),
677
+ )
678
+ )
679
+ if _response.status_code == 403:
680
+ raise ForbiddenError(
681
+ typing.cast(
682
+ typing.Optional[typing.Any],
683
+ parse_obj_as(
684
+ type_=typing.Optional[typing.Any], # type: ignore
685
+ object_=_response.json(),
686
+ ),
687
+ )
688
+ )
689
+ if _response.status_code == 500:
690
+ raise InternalServerError(
691
+ typing.cast(
692
+ typing.Optional[typing.Any],
693
+ parse_obj_as(
694
+ type_=typing.Optional[typing.Any], # type: ignore
695
+ object_=_response.json(),
696
+ ),
697
+ )
698
+ )
699
+ if _response.status_code == 503:
700
+ raise ServiceUnavailableError(
701
+ typing.cast(
702
+ typing.Optional[typing.Any],
703
+ parse_obj_as(
704
+ type_=typing.Optional[typing.Any], # type: ignore
705
+ object_=_response.json(),
706
+ ),
707
+ )
708
+ )
709
+ _response_json = _response.json()
710
+ except JSONDecodeError:
711
+ raise ApiError(status_code=_response.status_code, body=_response.text)
712
+ raise ApiError(status_code=_response.status_code, body=_response_json)