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