From 40757a224475b1e05a4179466f2ee606fa4ddc18 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 06:07:10 +0000 Subject: [PATCH] SDK regeneration --- CONTRIBUTING.md | 19 - poetry.lock | 723 ++++++------ pyproject.toml | 9 +- src/elevenlabs/__init__.py | 70 +- .../{resources => }/audio_native/__init__.py | 0 src/elevenlabs/audio_native/client.py | 454 ++++++++ src/elevenlabs/{client.py => base_client.py} | 97 +- src/elevenlabs/clone.py | 26 - src/elevenlabs/core/__init__.py | 8 + src/elevenlabs/core/client_wrapper.py | 28 +- src/elevenlabs/core/file.py | 45 +- src/elevenlabs/core/http_client.py | 125 ++ src/elevenlabs/core/request_options.py | 32 + src/elevenlabs/generate.py | 57 - .../{resources => }/history/__init__.py | 0 src/elevenlabs/history/client.py | 565 +++++++++ .../{resources => }/models/__init__.py | 0 src/elevenlabs/models/client.py | 117 ++ .../resources => projects}/__init__.py | 0 .../chapters}/__init__.py | 0 src/elevenlabs/projects/chapters/client.py | 479 ++++++++ .../chapters}/snapshots/__init__.py | 0 .../chapters}/snapshots/client.py | 143 ++- src/elevenlabs/projects/client.py | 1024 +++++++++++++++++ .../pronunciation_dictionary/__init__.py | 0 .../pronunciation_dictionary/client.py | 258 +++++ src/elevenlabs/resources/__init__.py | 15 - .../resources/audio_native/client.py | 174 --- src/elevenlabs/resources/history/client.py | 348 ------ src/elevenlabs/resources/models/client.py | 82 -- src/elevenlabs/resources/projects/__init__.py | 5 - src/elevenlabs/resources/projects/client.py | 645 ----------- .../projects/resources/chapters/__init__.py | 5 - .../projects/resources/chapters/client.py | 316 ----- .../pronunciation_dictionary/client.py | 167 --- src/elevenlabs/resources/samples/client.py | 173 --- src/elevenlabs/resources/user/client.py | 138 --- src/elevenlabs/resources/voices/client.py | 685 ----------- .../{resources => }/samples/__init__.py | 0 src/elevenlabs/samples/client.py | 252 ++++ .../text_to_speech/__init__.py | 0 .../{resources => }/text_to_speech/client.py | 183 ++- src/elevenlabs/types/__init__.py | 42 +- src/elevenlabs/types/accent.py | 33 - ...pronunciation_dictionary_response_model.py | 2 +- src/elevenlabs/types/age.py | 25 - .../types/chapter_response_model.py | 10 +- ...> extended_subscription_response_model.py} | 16 +- ...ed_subscription_response_model_currency.py | 17 - src/elevenlabs/types/feedback_item.py | 2 +- .../types/fine_tuning_response_model.py | 22 +- ...finetunig_state.py => finetuning_state.py} | 8 +- src/elevenlabs/types/gender.py | 17 - ...story.py => get_history_response_model.py} | 4 +- ...tion_dictionary_metadata_response_model.py | 2 +- src/elevenlabs/types/history_item.py | 16 +- src/elevenlabs/types/http_validation_error.py | 2 +- .../types/invoice_response_model.py | 32 +- .../types/invoice_response_model_currency.py | 17 - .../{history_item_state.py => item_state.py} | 8 +- .../types/{model.py => model_response.py} | 28 +- .../types/project_extended_response_model.py | 2 +- .../types/project_response_model.py | 8 +- ...ice_sample.py => sample_response_model.py} | 12 +- ...apter_response_model_state.py => state.py} | 6 +- src/elevenlabs/types/subscription_response.py | 2 +- .../types/{user.py => user_response.py} | 2 +- .../verification_attempt_response_model.py | 2 +- src/elevenlabs/types/voice_response.py | 14 +- src/elevenlabs/types/voice_settings.py | 8 +- .../types/voice_sharing_response_model.py | 6 +- .../{resources => }/user/__init__.py | 0 src/elevenlabs/user/client.py | 210 ++++ src/elevenlabs/voice.py | 44 - .../{resources => }/voices/__init__.py | 0 src/elevenlabs/voices/client.py | 920 +++++++++++++++ 76 files changed, 5313 insertions(+), 3693 deletions(-) delete mode 100644 CONTRIBUTING.md rename src/elevenlabs/{resources => }/audio_native/__init__.py (100%) create mode 100644 src/elevenlabs/audio_native/client.py rename src/elevenlabs/{client.py => base_client.py} (52%) delete mode 100644 src/elevenlabs/clone.py create mode 100644 src/elevenlabs/core/http_client.py create mode 100644 src/elevenlabs/core/request_options.py delete mode 100644 src/elevenlabs/generate.py rename src/elevenlabs/{resources => }/history/__init__.py (100%) create mode 100644 src/elevenlabs/history/client.py rename src/elevenlabs/{resources => }/models/__init__.py (100%) create mode 100644 src/elevenlabs/models/client.py rename src/elevenlabs/{resources/projects/resources => projects}/__init__.py (100%) rename src/elevenlabs/{resources/projects/resources/chapters/resources => projects/chapters}/__init__.py (100%) create mode 100644 src/elevenlabs/projects/chapters/client.py rename src/elevenlabs/{resources/projects/resources/chapters/resources => projects/chapters}/snapshots/__init__.py (100%) rename src/elevenlabs/{resources/projects/resources/chapters/resources => projects/chapters}/snapshots/client.py (51%) create mode 100644 src/elevenlabs/projects/client.py rename src/elevenlabs/{resources => }/pronunciation_dictionary/__init__.py (100%) create mode 100644 src/elevenlabs/pronunciation_dictionary/client.py delete mode 100644 src/elevenlabs/resources/__init__.py delete mode 100644 src/elevenlabs/resources/audio_native/client.py delete mode 100644 src/elevenlabs/resources/history/client.py delete mode 100644 src/elevenlabs/resources/models/client.py delete mode 100644 src/elevenlabs/resources/projects/__init__.py delete mode 100644 src/elevenlabs/resources/projects/client.py delete mode 100644 src/elevenlabs/resources/projects/resources/chapters/__init__.py delete mode 100644 src/elevenlabs/resources/projects/resources/chapters/client.py delete mode 100644 src/elevenlabs/resources/pronunciation_dictionary/client.py delete mode 100644 src/elevenlabs/resources/samples/client.py delete mode 100644 src/elevenlabs/resources/user/client.py delete mode 100644 src/elevenlabs/resources/voices/client.py rename src/elevenlabs/{resources => }/samples/__init__.py (100%) create mode 100644 src/elevenlabs/samples/client.py rename src/elevenlabs/{resources => }/text_to_speech/__init__.py (100%) rename src/elevenlabs/{resources => }/text_to_speech/client.py (71%) delete mode 100644 src/elevenlabs/types/accent.py delete mode 100644 src/elevenlabs/types/age.py rename src/elevenlabs/types/{subscription.py => extended_subscription_response_model.py} (73%) delete mode 100644 src/elevenlabs/types/extended_subscription_response_model_currency.py rename src/elevenlabs/types/{finetunig_state.py => finetuning_state.py} (74%) delete mode 100644 src/elevenlabs/types/gender.py rename src/elevenlabs/types/{history.py => get_history_response_model.py} (89%) delete mode 100644 src/elevenlabs/types/invoice_response_model_currency.py rename src/elevenlabs/types/{history_item_state.py => item_state.py} (73%) rename src/elevenlabs/types/{model.py => model_response.py} (57%) rename src/elevenlabs/types/{voice_sample.py => sample_response_model.py} (79%) rename src/elevenlabs/types/{chapter_response_model_state.py => state.py} (69%) rename src/elevenlabs/types/{user.py => user_response.py} (96%) rename src/elevenlabs/{resources => }/user/__init__.py (100%) create mode 100644 src/elevenlabs/user/client.py delete mode 100644 src/elevenlabs/voice.py rename src/elevenlabs/{resources => }/voices/__init__.py (100%) create mode 100644 src/elevenlabs/voices/client.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 1b02e38..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,19 +0,0 @@ -## Contributing - -While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! - -On the other hand, contributions to the README are always very welcome! - -### Tests - -Run the following commands from the root of the repo - -```sh -ELEVEN_API_KEY= poetry run pytest -sv -``` - -### Run a specific test -_e.g. `test_voice_design` in the `elevenlabs/tests/api/test_voice.py` file_ -```sh -ELEVEN_API_KEY= poerty run pytest elevenlabs/tests/api/test_voice.py::test_voice_design -sv -``` \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 9ac7933..79edff2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,14 +1,14 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" -version = "0.5.0" +version = "0.6.0" description = "Reusable constraint types to use with typing.Annotated" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, - {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, + {file = "annotated_types-0.6.0-py3-none-any.whl", hash = "sha256:0641064de18ba7a25dee8f96403ebc39113d0cb953a01429249d5c7564666a43"}, + {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, ] [package.dependencies] @@ -16,37 +16,55 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anyio" -version = "3.7.1" +version = "4.3.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, - {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, + {file = "anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8"}, + {file = "anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6"}, ] [package.dependencies] -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} +exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] -doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] -test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (<0.22)"] +doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (>=0.23)"] [[package]] name = "appnope" -version = "0.1.3" +version = "0.1.4" description = "Disable App Nap on macOS >= 10.9" optional = false +python-versions = ">=3.6" +files = [ + {file = "appnope-0.1.4-py2.py3-none-any.whl", hash = "sha256:502575ee11cd7a28c0205f379b525beefebab9d161b7c964670864014ed7213c"}, + {file = "appnope-0.1.4.tar.gz", hash = "sha256:1de3860566df9caf38f01f86f65e0e13e379af54f9e4bee1e66b48f2efffd1ee"}, +] + +[[package]] +name = "asttokens" +version = "2.4.1" +description = "Annotate AST trees with source code positions" +optional = false python-versions = "*" files = [ - {file = "appnope-0.1.3-py2.py3-none-any.whl", hash = "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e"}, - {file = "appnope-0.1.3.tar.gz", hash = "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24"}, + {file = "asttokens-2.4.1-py2.py3-none-any.whl", hash = "sha256:051ed49c3dcae8913ea7cd08e46a606dba30b79993209636c4875bc1d637bc24"}, + {file = "asttokens-2.4.1.tar.gz", hash = "sha256:b03869718ba9a6eb027e134bfdf69f38a236d681c83c160d510768af11254ba0"}, ] +[package.dependencies] +six = ">=1.12.0" + +[package.extras] +astroid = ["astroid (>=1,<2)", "astroid (>=2,<4)"] +test = ["astroid (>=1,<2)", "astroid (>=2,<4)", "pytest"] + [[package]] name = "backcall" version = "0.2.0" @@ -60,13 +78,13 @@ files = [ [[package]] name = "certifi" -version = "2023.11.17" +version = "2024.2.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, - {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, + {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, + {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] [[package]] @@ -204,6 +222,20 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "executing" +version = "2.0.1" +description = "Get the currently executing AST node of a frame, and other information" +optional = false +python-versions = ">=3.5" +files = [ + {file = "executing-2.0.1-py2.py3-none-any.whl", hash = "sha256:eac49ca94516ccc753f9fb5ce82603156e590b27525a8bc32cce8ae302eb61bc"}, + {file = "executing-2.0.1.tar.gz", hash = "sha256:35afe2ce3affba8ee97f2d69927fa823b08b472b7b994e36a52a964b93d16147"}, +] + +[package.extras] +tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipython", "littleutils", "pytest", "rich"] + [[package]] name = "h11" version = "0.14.0" @@ -215,44 +247,42 @@ files = [ {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, ] -[package.dependencies] -typing-extensions = {version = "*", markers = "python_version < \"3.8\""} - [[package]] name = "httpcore" -version = "0.17.3" +version = "1.0.4" description = "A minimal low-level HTTP client." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"}, - {file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"}, + {file = "httpcore-1.0.4-py3-none-any.whl", hash = "sha256:ac418c1db41bade2ad53ae2f3834a3a0f5ae76b56cf5aa497d2d033384fc7d73"}, + {file = "httpcore-1.0.4.tar.gz", hash = "sha256:cb2839ccfcba0d2d3c1131d3c3e26dfc327326fbe7a5dc0dbfe9f6c9151bb022"}, ] [package.dependencies] -anyio = ">=3.0,<5.0" certifi = "*" h11 = ">=0.13,<0.15" -sniffio = "==1.*" [package.extras] +asyncio = ["anyio (>=4.0,<5.0)"] http2 = ["h2 (>=3,<5)"] socks = ["socksio (==1.*)"] +trio = ["trio (>=0.22.0,<0.25.0)"] [[package]] name = "httpx" -version = "0.24.1" +version = "0.27.0" description = "The next generation HTTP client." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "httpx-0.24.1-py3-none-any.whl", hash = "sha256:06781eb9ac53cde990577af654bd990a4949de37a28bdb4a230d434f3a30b9bd"}, - {file = "httpx-0.24.1.tar.gz", hash = "sha256:5853a43053df830c20f8110c5e69fe44d035d850b2dfe795e196f00fdb774bdd"}, + {file = "httpx-0.27.0-py3-none-any.whl", hash = "sha256:71d5465162c13681bff01ad59b2cc68dd838ea1f10e51574bac27103f00c91a5"}, + {file = "httpx-0.27.0.tar.gz", hash = "sha256:a0cb88a46f32dc874e04ee956e4c2764aba2aa228f650b06788ba6bda2962ab5"}, ] [package.dependencies] +anyio = "*" certifi = "*" -httpcore = ">=0.15.0,<0.18.0" +httpcore = "==1.*" idna = "*" sniffio = "*" @@ -273,26 +303,6 @@ files = [ {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] -[[package]] -name = "importlib-metadata" -version = "6.7.0" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.7" -files = [ - {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, - {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, -] - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -perf = ["ipython"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] - [[package]] name = "iniconfig" version = "2.0.0" @@ -306,13 +316,13 @@ files = [ [[package]] name = "ipython" -version = "7.34.0" +version = "8.12.3" description = "IPython: Productive Interactive Computing" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "ipython-7.34.0-py3-none-any.whl", hash = "sha256:c175d2440a1caff76116eb719d40538fbb316e214eda85c5515c303aacbfb23e"}, - {file = "ipython-7.34.0.tar.gz", hash = "sha256:af3bdb46aa292bce5615b1b2ebc76c2080c5f77f54bda2ec72461317273e7cd6"}, + {file = "ipython-8.12.3-py3-none-any.whl", hash = "sha256:b0340d46a933d27c657b211a329d0be23793c36595acf9e6ef4164bc01a1804c"}, + {file = "ipython-8.12.3.tar.gz", hash = "sha256:3910c4b54543c2ad73d06579aa771041b7d5707b033bd488669b4cf544e3b363"}, ] [package.dependencies] @@ -324,21 +334,24 @@ jedi = ">=0.16" matplotlib-inline = "*" pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""} pickleshare = "*" -prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0" -pygments = "*" -setuptools = ">=18.5" -traitlets = ">=4.2" +prompt-toolkit = ">=3.0.30,<3.0.37 || >3.0.37,<3.1.0" +pygments = ">=2.4.0" +stack-data = "*" +traitlets = ">=5" +typing-extensions = {version = "*", markers = "python_version < \"3.10\""} [package.extras] -all = ["Sphinx (>=1.3)", "ipykernel", "ipyparallel", "ipywidgets", "nbconvert", "nbformat", "nose (>=0.10.1)", "notebook", "numpy (>=1.17)", "pygments", "qtconsole", "requests", "testpath"] -doc = ["Sphinx (>=1.3)"] +all = ["black", "curio", "docrepr", "ipykernel", "ipyparallel", "ipywidgets", "matplotlib", "matplotlib (!=3.2.0)", "nbconvert", "nbformat", "notebook", "numpy (>=1.21)", "pandas", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio", "qtconsole", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "trio", "typing-extensions"] +black = ["black"] +doc = ["docrepr", "ipykernel", "matplotlib", "pytest (<7)", "pytest (<7.1)", "pytest-asyncio", "setuptools (>=18.5)", "sphinx (>=1.3)", "sphinx-rtd-theme", "stack-data", "testpath", "typing-extensions"] kernel = ["ipykernel"] nbconvert = ["nbconvert"] nbformat = ["nbformat"] notebook = ["ipywidgets", "notebook"] parallel = ["ipyparallel"] qtconsole = ["qtconsole"] -test = ["ipykernel", "nbformat", "nose (>=0.10.1)", "numpy (>=1.17)", "pygments", "requests", "testpath"] +test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] +test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] [[package]] name = "jedi" @@ -375,45 +388,49 @@ traitlets = "*" [[package]] name = "mypy" -version = "0.971" +version = "1.8.0" description = "Optional static typing for Python" optional = false -python-versions = ">=3.6" -files = [ - {file = "mypy-0.971-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f2899a3cbd394da157194f913a931edfd4be5f274a88041c9dc2d9cdcb1c315c"}, - {file = "mypy-0.971-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:98e02d56ebe93981c41211c05adb630d1d26c14195d04d95e49cd97dbc046dc5"}, - {file = "mypy-0.971-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:19830b7dba7d5356d3e26e2427a2ec91c994cd92d983142cbd025ebe81d69cf3"}, - {file = "mypy-0.971-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:02ef476f6dcb86e6f502ae39a16b93285fef97e7f1ff22932b657d1ef1f28655"}, - {file = "mypy-0.971-cp310-cp310-win_amd64.whl", hash = "sha256:25c5750ba5609a0c7550b73a33deb314ecfb559c350bb050b655505e8aed4103"}, - {file = "mypy-0.971-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d3348e7eb2eea2472db611486846742d5d52d1290576de99d59edeb7cd4a42ca"}, - {file = "mypy-0.971-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3fa7a477b9900be9b7dd4bab30a12759e5abe9586574ceb944bc29cddf8f0417"}, - {file = "mypy-0.971-cp36-cp36m-win_amd64.whl", hash = "sha256:2ad53cf9c3adc43cf3bea0a7d01a2f2e86db9fe7596dfecb4496a5dda63cbb09"}, - {file = "mypy-0.971-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:855048b6feb6dfe09d3353466004490b1872887150c5bb5caad7838b57328cc8"}, - {file = "mypy-0.971-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:23488a14a83bca6e54402c2e6435467a4138785df93ec85aeff64c6170077fb0"}, - {file = "mypy-0.971-cp37-cp37m-win_amd64.whl", hash = "sha256:4b21e5b1a70dfb972490035128f305c39bc4bc253f34e96a4adf9127cf943eb2"}, - {file = "mypy-0.971-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:9796a2ba7b4b538649caa5cecd398d873f4022ed2333ffde58eaf604c4d2cb27"}, - {file = "mypy-0.971-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5a361d92635ad4ada1b1b2d3630fc2f53f2127d51cf2def9db83cba32e47c856"}, - {file = "mypy-0.971-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b793b899f7cf563b1e7044a5c97361196b938e92f0a4343a5d27966a53d2ec71"}, - {file = "mypy-0.971-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d1ea5d12c8e2d266b5fb8c7a5d2e9c0219fedfeb493b7ed60cd350322384ac27"}, - {file = "mypy-0.971-cp38-cp38-win_amd64.whl", hash = "sha256:23c7ff43fff4b0df93a186581885c8512bc50fc4d4910e0f838e35d6bb6b5e58"}, - {file = "mypy-0.971-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1f7656b69974a6933e987ee8ffb951d836272d6c0f81d727f1d0e2696074d9e6"}, - {file = "mypy-0.971-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d2022bfadb7a5c2ef410d6a7c9763188afdb7f3533f22a0a32be10d571ee4bbe"}, - {file = "mypy-0.971-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ef943c72a786b0f8d90fd76e9b39ce81fb7171172daf84bf43eaf937e9f220a9"}, - {file = "mypy-0.971-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d744f72eb39f69312bc6c2abf8ff6656973120e2eb3f3ec4f758ed47e414a4bf"}, - {file = "mypy-0.971-cp39-cp39-win_amd64.whl", hash = "sha256:77a514ea15d3007d33a9e2157b0ba9c267496acf12a7f2b9b9f8446337aac5b0"}, - {file = "mypy-0.971-py3-none-any.whl", hash = "sha256:0d054ef16b071149917085f51f89555a576e2618d5d9dd70bd6eea6410af3ac9"}, - {file = "mypy-0.971.tar.gz", hash = "sha256:40b0f21484238269ae6a57200c807d80debc6459d444c0489a102d7c6a75fa56"}, +python-versions = ">=3.8" +files = [ + {file = "mypy-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:485a8942f671120f76afffff70f259e1cd0f0cfe08f81c05d8816d958d4577d3"}, + {file = "mypy-1.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:df9824ac11deaf007443e7ed2a4a26bebff98d2bc43c6da21b2b64185da011c4"}, + {file = "mypy-1.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2afecd6354bbfb6e0160f4e4ad9ba6e4e003b767dd80d85516e71f2e955ab50d"}, + {file = "mypy-1.8.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8963b83d53ee733a6e4196954502b33567ad07dfd74851f32be18eb932fb1cb9"}, + {file = "mypy-1.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:e46f44b54ebddbeedbd3d5b289a893219065ef805d95094d16a0af6630f5d410"}, + {file = "mypy-1.8.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:855fe27b80375e5c5878492f0729540db47b186509c98dae341254c8f45f42ae"}, + {file = "mypy-1.8.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4c886c6cce2d070bd7df4ec4a05a13ee20c0aa60cb587e8d1265b6c03cf91da3"}, + {file = "mypy-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d19c413b3c07cbecf1f991e2221746b0d2a9410b59cb3f4fb9557f0365a1a817"}, + {file = "mypy-1.8.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9261ed810972061388918c83c3f5cd46079d875026ba97380f3e3978a72f503d"}, + {file = "mypy-1.8.0-cp311-cp311-win_amd64.whl", hash = "sha256:51720c776d148bad2372ca21ca29256ed483aa9a4cdefefcef49006dff2a6835"}, + {file = "mypy-1.8.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:52825b01f5c4c1c4eb0db253ec09c7aa17e1a7304d247c48b6f3599ef40db8bd"}, + {file = "mypy-1.8.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f5ac9a4eeb1ec0f1ccdc6f326bcdb464de5f80eb07fb38b5ddd7b0de6bc61e55"}, + {file = "mypy-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afe3fe972c645b4632c563d3f3eff1cdca2fa058f730df2b93a35e3b0c538218"}, + {file = "mypy-1.8.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:42c6680d256ab35637ef88891c6bd02514ccb7e1122133ac96055ff458f93fc3"}, + {file = "mypy-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:720a5ca70e136b675af3af63db533c1c8c9181314d207568bbe79051f122669e"}, + {file = "mypy-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:028cf9f2cae89e202d7b6593cd98db6759379f17a319b5faf4f9978d7084cdc6"}, + {file = "mypy-1.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4e6d97288757e1ddba10dd9549ac27982e3e74a49d8d0179fc14d4365c7add66"}, + {file = "mypy-1.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f1478736fcebb90f97e40aff11a5f253af890c845ee0c850fe80aa060a267c6"}, + {file = "mypy-1.8.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42419861b43e6962a649068a61f4a4839205a3ef525b858377a960b9e2de6e0d"}, + {file = "mypy-1.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:2b5b6c721bd4aabaadead3a5e6fa85c11c6c795e0c81a7215776ef8afc66de02"}, + {file = "mypy-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c1538c38584029352878a0466f03a8ee7547d7bd9f641f57a0f3017a7c905b8"}, + {file = "mypy-1.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ef4be7baf08a203170f29e89d79064463b7fc7a0908b9d0d5114e8009c3a259"}, + {file = "mypy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7178def594014aa6c35a8ff411cf37d682f428b3b5617ca79029d8ae72f5402b"}, + {file = "mypy-1.8.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ab3c84fa13c04aeeeabb2a7f67a25ef5d77ac9d6486ff33ded762ef353aa5592"}, + {file = "mypy-1.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:99b00bc72855812a60d253420d8a2eae839b0afa4938f09f4d2aa9bb4654263a"}, + {file = "mypy-1.8.0-py3-none-any.whl", hash = "sha256:538fd81bb5e430cc1381a443971c0475582ff9f434c16cd46d2c66763ce85d9d"}, + {file = "mypy-1.8.0.tar.gz", hash = "sha256:6ff8b244d7085a0b425b56d327b480c3b29cafbd2eff27316a004f9a7391ae07"}, ] [package.dependencies] -mypy-extensions = ">=0.4.3" +mypy-extensions = ">=1.0.0" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} -typing-extensions = ">=3.10" +typing-extensions = ">=4.1.0" [package.extras] dmypy = ["psutil (>=4.0)"] -python2 = ["typed-ast (>=1.4.0,<2)"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] reports = ["lxml"] [[package]] @@ -480,18 +497,15 @@ files = [ [[package]] name = "pluggy" -version = "1.2.0" +version = "1.4.0" description = "plugin and hook calling mechanisms for python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, - {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -521,20 +535,34 @@ files = [ {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, ] +[[package]] +name = "pure-eval" +version = "0.2.2" +description = "Safely evaluate AST nodes without side effects" +optional = false +python-versions = "*" +files = [ + {file = "pure_eval-0.2.2-py3-none-any.whl", hash = "sha256:01eaab343580944bc56080ebe0a674b39ec44a945e6d09ba7db3cb8cec289350"}, + {file = "pure_eval-0.2.2.tar.gz", hash = "sha256:2b45320af6dfaa1750f543d714b6d1c520a1688dec6fd24d339063ce0aaa9ac3"}, +] + +[package.extras] +tests = ["pytest"] + [[package]] name = "pydantic" -version = "2.4.2" +version = "2.6.3" description = "Data validation using Python type hints" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pydantic-2.4.2-py3-none-any.whl", hash = "sha256:bc3ddf669d234f4220e6e1c4d96b061abe0998185a8d7855c0126782b7abc8c1"}, - {file = "pydantic-2.4.2.tar.gz", hash = "sha256:94f336138093a5d7f426aac732dcfe7ab4eb4da243c88f891d65deb4a2556ee7"}, + {file = "pydantic-2.6.3-py3-none-any.whl", hash = "sha256:72c6034df47f46ccdf81869fddb81aade68056003900a8724a4f160700016a2a"}, + {file = "pydantic-2.6.3.tar.gz", hash = "sha256:e07805c4c7f5c6826e33a1d4c9d47950d7eaf34868e2690f8594d2e30241f11f"}, ] [package.dependencies] annotated-types = ">=0.4.0" -pydantic-core = "2.10.1" +pydantic-core = "2.16.3" typing-extensions = ">=4.6.1" [package.extras] @@ -542,117 +570,90 @@ email = ["email-validator (>=2.0.0)"] [[package]] name = "pydantic-core" -version = "2.10.1" +version = "2.16.3" description = "" optional = false -python-versions = ">=3.7" -files = [ - {file = "pydantic_core-2.10.1-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:d64728ee14e667ba27c66314b7d880b8eeb050e58ffc5fec3b7a109f8cddbd63"}, - {file = "pydantic_core-2.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:48525933fea744a3e7464c19bfede85df4aba79ce90c60b94d8b6e1eddd67096"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ef337945bbd76cce390d1b2496ccf9f90b1c1242a3a7bc242ca4a9fc5993427a"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1392e0638af203cee360495fd2cfdd6054711f2db5175b6e9c3c461b76f5175"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0675ba5d22de54d07bccde38997e780044dcfa9a71aac9fd7d4d7a1d2e3e65f7"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:128552af70a64660f21cb0eb4876cbdadf1a1f9d5de820fed6421fa8de07c893"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f6e6aed5818c264412ac0598b581a002a9f050cb2637a84979859e70197aa9e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ecaac27da855b8d73f92123e5f03612b04c5632fd0a476e469dfc47cd37d6b2e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b3c01c2fb081fced3bbb3da78510693dc7121bb893a1f0f5f4b48013201f362e"}, - {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:92f675fefa977625105708492850bcbc1182bfc3e997f8eecb866d1927c98ae6"}, - {file = "pydantic_core-2.10.1-cp310-none-win32.whl", hash = "sha256:420a692b547736a8d8703c39ea935ab5d8f0d2573f8f123b0a294e49a73f214b"}, - {file = "pydantic_core-2.10.1-cp310-none-win_amd64.whl", hash = "sha256:0880e239827b4b5b3e2ce05e6b766a7414e5f5aedc4523be6b68cfbc7f61c5d0"}, - {file = "pydantic_core-2.10.1-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:073d4a470b195d2b2245d0343569aac7e979d3a0dcce6c7d2af6d8a920ad0bea"}, - {file = "pydantic_core-2.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:600d04a7b342363058b9190d4e929a8e2e715c5682a70cc37d5ded1e0dd370b4"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39215d809470f4c8d1881758575b2abfb80174a9e8daf8f33b1d4379357e417c"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eeb3d3d6b399ffe55f9a04e09e635554012f1980696d6b0aca3e6cf42a17a03b"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7a7902bf75779bc12ccfc508bfb7a4c47063f748ea3de87135d433a4cca7a2f"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3625578b6010c65964d177626fde80cf60d7f2e297d56b925cb5cdeda6e9925a"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:caa48fc31fc7243e50188197b5f0c4228956f97b954f76da157aae7f67269ae8"}, - {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:07ec6d7d929ae9c68f716195ce15e745b3e8fa122fc67698ac6498d802ed0fa4"}, - {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e6f31a17acede6a8cd1ae2d123ce04d8cca74056c9d456075f4f6f85de055607"}, - {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d8f1ebca515a03e5654f88411420fea6380fc841d1bea08effb28184e3d4899f"}, - {file = "pydantic_core-2.10.1-cp311-none-win32.whl", hash = "sha256:6db2eb9654a85ada248afa5a6db5ff1cf0f7b16043a6b070adc4a5be68c716d6"}, - {file = "pydantic_core-2.10.1-cp311-none-win_amd64.whl", hash = "sha256:4a5be350f922430997f240d25f8219f93b0c81e15f7b30b868b2fddfc2d05f27"}, - {file = "pydantic_core-2.10.1-cp311-none-win_arm64.whl", hash = "sha256:5fdb39f67c779b183b0c853cd6b45f7db84b84e0571b3ef1c89cdb1dfc367325"}, - {file = "pydantic_core-2.10.1-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:b1f22a9ab44de5f082216270552aa54259db20189e68fc12484873d926426921"}, - {file = "pydantic_core-2.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8572cadbf4cfa95fb4187775b5ade2eaa93511f07947b38f4cd67cf10783b118"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db9a28c063c7c00844ae42a80203eb6d2d6bbb97070cfa00194dff40e6f545ab"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e2a35baa428181cb2270a15864ec6286822d3576f2ed0f4cd7f0c1708472aff"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05560ab976012bf40f25d5225a58bfa649bb897b87192a36c6fef1ab132540d7"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d6495008733c7521a89422d7a68efa0a0122c99a5861f06020ef5b1f51f9ba7c"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ac492c686defc8e6133e3a2d9eaf5261b3df26b8ae97450c1647286750b901"}, - {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8282bab177a9a3081fd3d0a0175a07a1e2bfb7fcbbd949519ea0980f8a07144d"}, - {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:aafdb89fdeb5fe165043896817eccd6434aee124d5ee9b354f92cd574ba5e78f"}, - {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f6defd966ca3b187ec6c366604e9296f585021d922e666b99c47e78738b5666c"}, - {file = "pydantic_core-2.10.1-cp312-none-win32.whl", hash = "sha256:7c4d1894fe112b0864c1fa75dffa045720a194b227bed12f4be7f6045b25209f"}, - {file = "pydantic_core-2.10.1-cp312-none-win_amd64.whl", hash = "sha256:5994985da903d0b8a08e4935c46ed8daf5be1cf217489e673910951dc533d430"}, - {file = "pydantic_core-2.10.1-cp312-none-win_arm64.whl", hash = "sha256:0d8a8adef23d86d8eceed3e32e9cca8879c7481c183f84ed1a8edc7df073af94"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:9badf8d45171d92387410b04639d73811b785b5161ecadabf056ea14d62d4ede"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:ebedb45b9feb7258fac0a268a3f6bec0a2ea4d9558f3d6f813f02ff3a6dc6698"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfe1090245c078720d250d19cb05d67e21a9cd7c257698ef139bc41cf6c27b4f"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e357571bb0efd65fd55f18db0a2fb0ed89d0bb1d41d906b138f088933ae618bb"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3dcd587b69bbf54fc04ca157c2323b8911033e827fffaecf0cafa5a892a0904"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c120c9ce3b163b985a3b966bb701114beb1da4b0468b9b236fc754783d85aa3"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15d6bca84ffc966cc9976b09a18cf9543ed4d4ecbd97e7086f9ce9327ea48891"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5cabb9710f09d5d2e9e2748c3e3e20d991a4c5f96ed8f1132518f54ab2967221"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:82f55187a5bebae7d81d35b1e9aaea5e169d44819789837cdd4720d768c55d15"}, - {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:1d40f55222b233e98e3921df7811c27567f0e1a4411b93d4c5c0f4ce131bc42f"}, - {file = "pydantic_core-2.10.1-cp37-none-win32.whl", hash = "sha256:14e09ff0b8fe6e46b93d36a878f6e4a3a98ba5303c76bb8e716f4878a3bee92c"}, - {file = "pydantic_core-2.10.1-cp37-none-win_amd64.whl", hash = "sha256:1396e81b83516b9d5c9e26a924fa69164156c148c717131f54f586485ac3c15e"}, - {file = "pydantic_core-2.10.1-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:6835451b57c1b467b95ffb03a38bb75b52fb4dc2762bb1d9dbed8de31ea7d0fc"}, - {file = "pydantic_core-2.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b00bc4619f60c853556b35f83731bd817f989cba3e97dc792bb8c97941b8053a"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fa467fd300a6f046bdb248d40cd015b21b7576c168a6bb20aa22e595c8ffcdd"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d99277877daf2efe074eae6338453a4ed54a2d93fb4678ddfe1209a0c93a2468"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fa7db7558607afeccb33c0e4bf1c9a9a835e26599e76af6fe2fcea45904083a6"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aad7bd686363d1ce4ee930ad39f14e1673248373f4a9d74d2b9554f06199fb58"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:443fed67d33aa85357464f297e3d26e570267d1af6fef1c21ca50921d2976302"}, - {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:042462d8d6ba707fd3ce9649e7bf268633a41018d6a998fb5fbacb7e928a183e"}, - {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ecdbde46235f3d560b18be0cb706c8e8ad1b965e5c13bbba7450c86064e96561"}, - {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ed550ed05540c03f0e69e6d74ad58d026de61b9eaebebbaaf8873e585cbb18de"}, - {file = "pydantic_core-2.10.1-cp38-none-win32.whl", hash = "sha256:8cdbbd92154db2fec4ec973d45c565e767ddc20aa6dbaf50142676484cbff8ee"}, - {file = "pydantic_core-2.10.1-cp38-none-win_amd64.whl", hash = "sha256:9f6f3e2598604956480f6c8aa24a3384dbf6509fe995d97f6ca6103bb8c2534e"}, - {file = "pydantic_core-2.10.1-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:655f8f4c8d6a5963c9a0687793da37b9b681d9ad06f29438a3b2326d4e6b7970"}, - {file = "pydantic_core-2.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e570ffeb2170e116a5b17e83f19911020ac79d19c96f320cbfa1fa96b470185b"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64322bfa13e44c6c30c518729ef08fda6026b96d5c0be724b3c4ae4da939f875"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:485a91abe3a07c3a8d1e082ba29254eea3e2bb13cbbd4351ea4e5a21912cc9b0"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7c2b8eb9fc872e68b46eeaf835e86bccc3a58ba57d0eedc109cbb14177be531"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a5cb87bdc2e5f620693148b5f8f842d293cae46c5f15a1b1bf7ceeed324a740c"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:25bd966103890ccfa028841a8f30cebcf5875eeac8c4bde4fe221364c92f0c9a"}, - {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f323306d0556351735b54acbf82904fe30a27b6a7147153cbe6e19aaaa2aa429"}, - {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0c27f38dc4fbf07b358b2bc90edf35e82d1703e22ff2efa4af4ad5de1b3833e7"}, - {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f1365e032a477c1430cfe0cf2856679529a2331426f8081172c4a74186f1d595"}, - {file = "pydantic_core-2.10.1-cp39-none-win32.whl", hash = "sha256:a1c311fd06ab3b10805abb72109f01a134019739bd3286b8ae1bc2fc4e50c07a"}, - {file = "pydantic_core-2.10.1-cp39-none-win_amd64.whl", hash = "sha256:ae8a8843b11dc0b03b57b52793e391f0122e740de3df1474814c700d2622950a"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d43002441932f9a9ea5d6f9efaa2e21458221a3a4b417a14027a1d530201ef1b"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fcb83175cc4936a5425dde3356f079ae03c0802bbdf8ff82c035f8a54b333521"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:962ed72424bf1f72334e2f1e61b68f16c0e596f024ca7ac5daf229f7c26e4208"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2cf5bb4dd67f20f3bbc1209ef572a259027c49e5ff694fa56bed62959b41e1f9"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e544246b859f17373bed915182ab841b80849ed9cf23f1f07b73b7c58baee5fb"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c0877239307b7e69d025b73774e88e86ce82f6ba6adf98f41069d5b0b78bd1bf"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:53df009d1e1ba40f696f8995683e067e3967101d4bb4ea6f667931b7d4a01357"}, - {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a1254357f7e4c82e77c348dabf2d55f1d14d19d91ff025004775e70a6ef40ada"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:524ff0ca3baea164d6d93a32c58ac79eca9f6cf713586fdc0adb66a8cdeab96a"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f0ac9fb8608dbc6eaf17956bf623c9119b4db7dbb511650910a82e261e6600f"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:320f14bd4542a04ab23747ff2c8a778bde727158b606e2661349557f0770711e"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:63974d168b6233b4ed6a0046296803cb13c56637a7b8106564ab575926572a55"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:417243bf599ba1f1fef2bb8c543ceb918676954734e2dcb82bf162ae9d7bd514"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dda81e5ec82485155a19d9624cfcca9be88a405e2857354e5b089c2a982144b2"}, - {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:14cfbb00959259e15d684505263d5a21732b31248a5dd4941f73a3be233865b9"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:631cb7415225954fdcc2a024119101946793e5923f6c4d73a5914d27eb3d3a05"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:bec7dd208a4182e99c5b6c501ce0b1f49de2802448d4056091f8e630b28e9a52"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:149b8a07712f45b332faee1a2258d8ef1fb4a36f88c0c17cb687f205c5dc6e7d"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4d966c47f9dd73c2d32a809d2be529112d509321c5310ebf54076812e6ecd884"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7eb037106f5c6b3b0b864ad226b0b7ab58157124161d48e4b30c4a43fef8bc4b"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:154ea7c52e32dce13065dbb20a4a6f0cc012b4f667ac90d648d36b12007fa9f7"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e562617a45b5a9da5be4abe72b971d4f00bf8555eb29bb91ec2ef2be348cd132"}, - {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:f23b55eb5464468f9e0e9a9935ce3ed2a870608d5f534025cd5536bca25b1402"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:e9121b4009339b0f751955baf4543a0bfd6bc3f8188f8056b1a25a2d45099934"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:0523aeb76e03f753b58be33b26540880bac5aa54422e4462404c432230543f33"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e0e2959ef5d5b8dc9ef21e1a305a21a36e254e6a34432d00c72a92fdc5ecda5"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:da01bec0a26befab4898ed83b362993c844b9a607a86add78604186297eb047e"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f2e9072d71c1f6cfc79a36d4484c82823c560e6f5599c43c1ca6b5cdbd54f881"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:f36a3489d9e28fe4b67be9992a23029c3cec0babc3bd9afb39f49844a8c721c5"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f64f82cc3443149292b32387086d02a6c7fb39b8781563e0ca7b8d7d9cf72bd7"}, - {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:b4a6db486ac8e99ae696e09efc8b2b9fea67b63c8f88ba7a1a16c24a057a0776"}, - {file = "pydantic_core-2.10.1.tar.gz", hash = "sha256:0f8682dbdd2f67f8e1edddcbffcc29f60a6182b4901c367fc8c1c40d30bb0a82"}, +python-versions = ">=3.8" +files = [ + {file = "pydantic_core-2.16.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:75b81e678d1c1ede0785c7f46690621e4c6e63ccd9192af1f0bd9d504bbb6bf4"}, + {file = "pydantic_core-2.16.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9c865a7ee6f93783bd5d781af5a4c43dadc37053a5b42f7d18dc019f8c9d2bd1"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:162e498303d2b1c036b957a1278fa0899d02b2842f1ff901b6395104c5554a45"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2f583bd01bbfbff4eaee0868e6fc607efdfcc2b03c1c766b06a707abbc856187"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b926dd38db1519ed3043a4de50214e0d600d404099c3392f098a7f9d75029ff8"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:716b542728d4c742353448765aa7cdaa519a7b82f9564130e2b3f6766018c9ec"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc4ad7f7ee1a13d9cb49d8198cd7d7e3aa93e425f371a68235f784e99741561f"}, + {file = "pydantic_core-2.16.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bd87f48924f360e5d1c5f770d6155ce0e7d83f7b4e10c2f9ec001c73cf475c99"}, + {file = "pydantic_core-2.16.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0df446663464884297c793874573549229f9eca73b59360878f382a0fc085979"}, + {file = "pydantic_core-2.16.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4df8a199d9f6afc5ae9a65f8f95ee52cae389a8c6b20163762bde0426275b7db"}, + {file = "pydantic_core-2.16.3-cp310-none-win32.whl", hash = "sha256:456855f57b413f077dff513a5a28ed838dbbb15082ba00f80750377eed23d132"}, + {file = "pydantic_core-2.16.3-cp310-none-win_amd64.whl", hash = "sha256:732da3243e1b8d3eab8c6ae23ae6a58548849d2e4a4e03a1924c8ddf71a387cb"}, + {file = "pydantic_core-2.16.3-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:519ae0312616026bf4cedc0fe459e982734f3ca82ee8c7246c19b650b60a5ee4"}, + {file = "pydantic_core-2.16.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b3992a322a5617ded0a9f23fd06dbc1e4bd7cf39bc4ccf344b10f80af58beacd"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8d62da299c6ecb04df729e4b5c52dc0d53f4f8430b4492b93aa8de1f541c4aac"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2acca2be4bb2f2147ada8cac612f8a98fc09f41c89f87add7256ad27332c2fda"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1b662180108c55dfbf1280d865b2d116633d436cfc0bba82323554873967b340"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e7c6ed0dc9d8e65f24f5824291550139fe6f37fac03788d4580da0d33bc00c97"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6b1bb0827f56654b4437955555dc3aeeebeddc47c2d7ed575477f082622c49e"}, + {file = "pydantic_core-2.16.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e56f8186d6210ac7ece503193ec84104da7ceb98f68ce18c07282fcc2452e76f"}, + {file = "pydantic_core-2.16.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:936e5db01dd49476fa8f4383c259b8b1303d5dd5fb34c97de194560698cc2c5e"}, + {file = "pydantic_core-2.16.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:33809aebac276089b78db106ee692bdc9044710e26f24a9a2eaa35a0f9fa70ba"}, + {file = "pydantic_core-2.16.3-cp311-none-win32.whl", hash = "sha256:ded1c35f15c9dea16ead9bffcde9bb5c7c031bff076355dc58dcb1cb436c4721"}, + {file = "pydantic_core-2.16.3-cp311-none-win_amd64.whl", hash = "sha256:d89ca19cdd0dd5f31606a9329e309d4fcbb3df860960acec32630297d61820df"}, + {file = "pydantic_core-2.16.3-cp311-none-win_arm64.whl", hash = "sha256:6162f8d2dc27ba21027f261e4fa26f8bcb3cf9784b7f9499466a311ac284b5b9"}, + {file = "pydantic_core-2.16.3-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:0f56ae86b60ea987ae8bcd6654a887238fd53d1384f9b222ac457070b7ac4cff"}, + {file = "pydantic_core-2.16.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c9bd22a2a639e26171068f8ebb5400ce2c1bc7d17959f60a3b753ae13c632975"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4204e773b4b408062960e65468d5346bdfe139247ee5f1ca2a378983e11388a2"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f651dd19363c632f4abe3480a7c87a9773be27cfe1341aef06e8759599454120"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aaf09e615a0bf98d406657e0008e4a8701b11481840be7d31755dc9f97c44053"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8e47755d8152c1ab5b55928ab422a76e2e7b22b5ed8e90a7d584268dd49e9c6b"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:500960cb3a0543a724a81ba859da816e8cf01b0e6aaeedf2c3775d12ee49cade"}, + {file = "pydantic_core-2.16.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:cf6204fe865da605285c34cf1172879d0314ff267b1c35ff59de7154f35fdc2e"}, + {file = "pydantic_core-2.16.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d33dd21f572545649f90c38c227cc8631268ba25c460b5569abebdd0ec5974ca"}, + {file = "pydantic_core-2.16.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:49d5d58abd4b83fb8ce763be7794d09b2f50f10aa65c0f0c1696c677edeb7cbf"}, + {file = "pydantic_core-2.16.3-cp312-none-win32.whl", hash = "sha256:f53aace168a2a10582e570b7736cc5bef12cae9cf21775e3eafac597e8551fbe"}, + {file = "pydantic_core-2.16.3-cp312-none-win_amd64.whl", hash = "sha256:0d32576b1de5a30d9a97f300cc6a3f4694c428d956adbc7e6e2f9cad279e45ed"}, + {file = "pydantic_core-2.16.3-cp312-none-win_arm64.whl", hash = "sha256:ec08be75bb268473677edb83ba71e7e74b43c008e4a7b1907c6d57e940bf34b6"}, + {file = "pydantic_core-2.16.3-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:b1f6f5938d63c6139860f044e2538baeee6f0b251a1816e7adb6cbce106a1f01"}, + {file = "pydantic_core-2.16.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2a1ef6a36fdbf71538142ed604ad19b82f67b05749512e47f247a6ddd06afdc7"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:704d35ecc7e9c31d48926150afada60401c55efa3b46cd1ded5a01bdffaf1d48"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d937653a696465677ed583124b94a4b2d79f5e30b2c46115a68e482c6a591c8a"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c9803edf8e29bd825f43481f19c37f50d2b01899448273b3a7758441b512acf8"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:72282ad4892a9fb2da25defeac8c2e84352c108705c972db82ab121d15f14e6d"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f752826b5b8361193df55afcdf8ca6a57d0232653494ba473630a83ba50d8c9"}, + {file = "pydantic_core-2.16.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4384a8f68ddb31a0b0c3deae88765f5868a1b9148939c3f4121233314ad5532c"}, + {file = "pydantic_core-2.16.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:a4b2bf78342c40b3dc830880106f54328928ff03e357935ad26c7128bbd66ce8"}, + {file = "pydantic_core-2.16.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:13dcc4802961b5f843a9385fc821a0b0135e8c07fc3d9949fd49627c1a5e6ae5"}, + {file = "pydantic_core-2.16.3-cp38-none-win32.whl", hash = "sha256:e3e70c94a0c3841e6aa831edab1619ad5c511199be94d0c11ba75fe06efe107a"}, + {file = "pydantic_core-2.16.3-cp38-none-win_amd64.whl", hash = "sha256:ecdf6bf5f578615f2e985a5e1f6572e23aa632c4bd1dc67f8f406d445ac115ed"}, + {file = "pydantic_core-2.16.3-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:bda1ee3e08252b8d41fa5537413ffdddd58fa73107171a126d3b9ff001b9b820"}, + {file = "pydantic_core-2.16.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:21b888c973e4f26b7a96491c0965a8a312e13be108022ee510248fe379a5fa23"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be0ec334369316fa73448cc8c982c01e5d2a81c95969d58b8f6e272884df0074"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b5b6079cc452a7c53dd378c6f881ac528246b3ac9aae0f8eef98498a75657805"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ee8d5f878dccb6d499ba4d30d757111847b6849ae07acdd1205fffa1fc1253c"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7233d65d9d651242a68801159763d09e9ec96e8a158dbf118dc090cd77a104c9"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c6119dc90483a5cb50a1306adb8d52c66e447da88ea44f323e0ae1a5fcb14256"}, + {file = "pydantic_core-2.16.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:578114bc803a4c1ff9946d977c221e4376620a46cf78da267d946397dc9514a8"}, + {file = "pydantic_core-2.16.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d8f99b147ff3fcf6b3cc60cb0c39ea443884d5559a30b1481e92495f2310ff2b"}, + {file = "pydantic_core-2.16.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4ac6b4ce1e7283d715c4b729d8f9dab9627586dafce81d9eaa009dd7f25dd972"}, + {file = "pydantic_core-2.16.3-cp39-none-win32.whl", hash = "sha256:e7774b570e61cb998490c5235740d475413a1f6de823169b4cf94e2fe9e9f6b2"}, + {file = "pydantic_core-2.16.3-cp39-none-win_amd64.whl", hash = "sha256:9091632a25b8b87b9a605ec0e61f241c456e9248bfdcf7abdf344fdb169c81cf"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:36fa178aacbc277bc6b62a2c3da95226520da4f4e9e206fdf076484363895d2c"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:dcca5d2bf65c6fb591fff92da03f94cd4f315972f97c21975398bd4bd046854a"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2a72fb9963cba4cd5793854fd12f4cfee731e86df140f59ff52a49b3552db241"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b60cc1a081f80a2105a59385b92d82278b15d80ebb3adb200542ae165cd7d183"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:cbcc558401de90a746d02ef330c528f2e668c83350f045833543cd57ecead1ad"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:fee427241c2d9fb7192b658190f9f5fd6dfe41e02f3c1489d2ec1e6a5ab1e04a"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f4cb85f693044e0f71f394ff76c98ddc1bc0953e48c061725e540396d5c8a2e1"}, + {file = "pydantic_core-2.16.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:b29eeb887aa931c2fcef5aa515d9d176d25006794610c264ddc114c053bf96fe"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:a425479ee40ff021f8216c9d07a6a3b54b31c8267c6e17aa88b70d7ebd0e5e5b"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:5c5cbc703168d1b7a838668998308018a2718c2130595e8e190220238addc96f"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99b6add4c0b39a513d323d3b93bc173dac663c27b99860dd5bf491b240d26137"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75f76ee558751746d6a38f89d60b6228fa174e5172d143886af0f85aa306fd89"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:00ee1c97b5364b84cb0bd82e9bbf645d5e2871fb8c58059d158412fee2d33d8a"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:287073c66748f624be4cef893ef9174e3eb88fe0b8a78dc22e88eca4bc357ca6"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ed25e1835c00a332cb10c683cd39da96a719ab1dfc08427d476bce41b92531fc"}, + {file = "pydantic_core-2.16.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:86b3d0033580bd6bbe07590152007275bd7af95f98eaa5bd36f3da219dcd93da"}, + {file = "pydantic_core-2.16.3.tar.gz", hash = "sha256:1cac689f80a3abab2d3c0048b29eea5751114054f032a941a32de4c852c59cad"}, ] [package.dependencies] @@ -687,7 +688,6 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -718,32 +718,46 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] -name = "setuptools" -version = "68.0.0" -description = "Easily download, build, install, upgrade, and uninstall Python packages" +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=3.7" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" files = [ - {file = "setuptools-68.0.0-py3-none-any.whl", hash = "sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f"}, - {file = "setuptools-68.0.0.tar.gz", hash = "sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235"}, + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] -testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] - [[package]] name = "sniffio" -version = "1.3.0" +version = "1.3.1" description = "Sniff out which async library your code is running under" optional = false python-versions = ">=3.7" files = [ - {file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"}, - {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, + {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, + {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, ] +[[package]] +name = "stack-data" +version = "0.6.3" +description = "Extract data from python stack frames and tracebacks for informative displays" +optional = false +python-versions = "*" +files = [ + {file = "stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695"}, + {file = "stack_data-0.6.3.tar.gz", hash = "sha256:836a778de4fec4dcd1dcd89ed8abff8a221f58308462e1c4aa2a3cf30148f0b9"}, +] + +[package.dependencies] +asttokens = ">=2.1.0" +executing = ">=1.2.0" +pure-eval = "*" + +[package.extras] +tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"] + [[package]] name = "tomli" version = "2.0.1" @@ -757,94 +771,44 @@ files = [ [[package]] name = "traitlets" -version = "5.9.0" +version = "5.14.1" description = "Traitlets Python configuration system" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "traitlets-5.9.0-py3-none-any.whl", hash = "sha256:9e6ec080259b9a5940c797d58b613b5e31441c2257b87c2e795c5228ae80d2d8"}, - {file = "traitlets-5.9.0.tar.gz", hash = "sha256:f6cde21a9c68cf756af02035f72d5a723bf607e862e7be33ece505abf4a3bad9"}, + {file = "traitlets-5.14.1-py3-none-any.whl", hash = "sha256:2e5a030e6eff91737c643231bfcf04a65b0132078dad75e4936700b213652e74"}, + {file = "traitlets-5.14.1.tar.gz", hash = "sha256:8585105b371a04b8316a43d5ce29c098575c2e477850b62b848b964f1444527e"}, ] [package.extras] docs = ["myst-parser", "pydata-sphinx-theme", "sphinx"] -test = ["argcomplete (>=2.0)", "pre-commit", "pytest", "pytest-mock"] - -[[package]] -name = "typed-ast" -version = "1.5.5" -description = "a fork of Python 2 and 3 ast modules with type comment support" -optional = false -python-versions = ">=3.6" -files = [ - {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, - {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, - {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, - {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, - {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, - {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, - {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, - {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, - {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, - {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, - {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, - {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, - {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, - {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, - {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, - {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, - {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, - {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, - {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, - {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, - {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, - {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, - {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, - {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, - {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, - {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, -] +test = ["argcomplete (>=3.0.3)", "mypy (>=1.7.0)", "pre-commit", "pytest (>=7.0,<7.5)", "pytest-mock", "pytest-mypy-testing"] [[package]] name = "typing-extensions" -version = "4.7.1" -description = "Backported and Experimental Type Hints for Python 3.7+" +version = "4.10.0" +description = "Backported and Experimental Type Hints for Python 3.8+" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, - {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, + {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, + {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, ] [[package]] name = "urllib3" -version = "2.0.7" +version = "2.2.1" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, - {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, + {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, + {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -861,99 +825,86 @@ files = [ [[package]] name = "websockets" -version = "11.0.3" +version = "12.0" description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" optional = false -python-versions = ">=3.7" -files = [ - {file = "websockets-11.0.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3ccc8a0c387629aec40f2fc9fdcb4b9d5431954f934da3eaf16cdc94f67dbfac"}, - {file = "websockets-11.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d67ac60a307f760c6e65dad586f556dde58e683fab03323221a4e530ead6f74d"}, - {file = "websockets-11.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:84d27a4832cc1a0ee07cdcf2b0629a8a72db73f4cf6de6f0904f6661227f256f"}, - {file = "websockets-11.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffd7dcaf744f25f82190856bc26ed81721508fc5cbf2a330751e135ff1283564"}, - {file = "websockets-11.0.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7622a89d696fc87af8e8d280d9b421db5133ef5b29d3f7a1ce9f1a7bf7fcfa11"}, - {file = "websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bceab846bac555aff6427d060f2fcfff71042dba6f5fca7dc4f75cac815e57ca"}, - {file = "websockets-11.0.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:54c6e5b3d3a8936a4ab6870d46bdd6ec500ad62bde9e44462c32d18f1e9a8e54"}, - {file = "websockets-11.0.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:41f696ba95cd92dc047e46b41b26dd24518384749ed0d99bea0a941ca87404c4"}, - {file = "websockets-11.0.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:86d2a77fd490ae3ff6fae1c6ceaecad063d3cc2320b44377efdde79880e11526"}, - {file = "websockets-11.0.3-cp310-cp310-win32.whl", hash = "sha256:2d903ad4419f5b472de90cd2d40384573b25da71e33519a67797de17ef849b69"}, - {file = "websockets-11.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:1d2256283fa4b7f4c7d7d3e84dc2ece74d341bce57d5b9bf385df109c2a1a82f"}, - {file = "websockets-11.0.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:e848f46a58b9fcf3d06061d17be388caf70ea5b8cc3466251963c8345e13f7eb"}, - {file = "websockets-11.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:aa5003845cdd21ac0dc6c9bf661c5beddd01116f6eb9eb3c8e272353d45b3288"}, - {file = "websockets-11.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b58cbf0697721120866820b89f93659abc31c1e876bf20d0b3d03cef14faf84d"}, - {file = "websockets-11.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:660e2d9068d2bedc0912af508f30bbeb505bbbf9774d98def45f68278cea20d3"}, - {file = "websockets-11.0.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c1f0524f203e3bd35149f12157438f406eff2e4fb30f71221c8a5eceb3617b6b"}, - {file = "websockets-11.0.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:def07915168ac8f7853812cc593c71185a16216e9e4fa886358a17ed0fd9fcf6"}, - {file = "websockets-11.0.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b30c6590146e53149f04e85a6e4fcae068df4289e31e4aee1fdf56a0dead8f97"}, - {file = "websockets-11.0.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:619d9f06372b3a42bc29d0cd0354c9bb9fb39c2cbc1a9c5025b4538738dbffaf"}, - {file = "websockets-11.0.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:01f5567d9cf6f502d655151645d4e8b72b453413d3819d2b6f1185abc23e82dd"}, - {file = "websockets-11.0.3-cp311-cp311-win32.whl", hash = "sha256:e1459677e5d12be8bbc7584c35b992eea142911a6236a3278b9b5ce3326f282c"}, - {file = "websockets-11.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:e7837cb169eca3b3ae94cc5787c4fed99eef74c0ab9506756eea335e0d6f3ed8"}, - {file = "websockets-11.0.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:9f59a3c656fef341a99e3d63189852be7084c0e54b75734cde571182c087b152"}, - {file = "websockets-11.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2529338a6ff0eb0b50c7be33dc3d0e456381157a31eefc561771ee431134a97f"}, - {file = "websockets-11.0.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:34fd59a4ac42dff6d4681d8843217137f6bc85ed29722f2f7222bd619d15e95b"}, - {file = "websockets-11.0.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:332d126167ddddec94597c2365537baf9ff62dfcc9db4266f263d455f2f031cb"}, - {file = "websockets-11.0.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:6505c1b31274723ccaf5f515c1824a4ad2f0d191cec942666b3d0f3aa4cb4007"}, - {file = "websockets-11.0.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f467ba0050b7de85016b43f5a22b46383ef004c4f672148a8abf32bc999a87f0"}, - {file = "websockets-11.0.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:9d9acd80072abcc98bd2c86c3c9cd4ac2347b5a5a0cae7ed5c0ee5675f86d9af"}, - {file = "websockets-11.0.3-cp37-cp37m-win32.whl", hash = "sha256:e590228200fcfc7e9109509e4d9125eace2042fd52b595dd22bbc34bb282307f"}, - {file = "websockets-11.0.3-cp37-cp37m-win_amd64.whl", hash = "sha256:b16fff62b45eccb9c7abb18e60e7e446998093cdcb50fed33134b9b6878836de"}, - {file = "websockets-11.0.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:fb06eea71a00a7af0ae6aefbb932fb8a7df3cb390cc217d51a9ad7343de1b8d0"}, - {file = "websockets-11.0.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8a34e13a62a59c871064dfd8ffb150867e54291e46d4a7cf11d02c94a5275bae"}, - {file = "websockets-11.0.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4841ed00f1026dfbced6fca7d963c4e7043aa832648671b5138008dc5a8f6d99"}, - {file = "websockets-11.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a073fc9ab1c8aff37c99f11f1641e16da517770e31a37265d2755282a5d28aa"}, - {file = "websockets-11.0.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:68b977f21ce443d6d378dbd5ca38621755f2063d6fdb3335bda981d552cfff86"}, - {file = "websockets-11.0.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1a99a7a71631f0efe727c10edfba09ea6bee4166a6f9c19aafb6c0b5917d09c"}, - {file = "websockets-11.0.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bee9fcb41db2a23bed96c6b6ead6489702c12334ea20a297aa095ce6d31370d0"}, - {file = "websockets-11.0.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:4b253869ea05a5a073ebfdcb5cb3b0266a57c3764cf6fe114e4cd90f4bfa5f5e"}, - {file = "websockets-11.0.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:1553cb82942b2a74dd9b15a018dce645d4e68674de2ca31ff13ebc2d9f283788"}, - {file = "websockets-11.0.3-cp38-cp38-win32.whl", hash = "sha256:f61bdb1df43dc9c131791fbc2355535f9024b9a04398d3bd0684fc16ab07df74"}, - {file = "websockets-11.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:03aae4edc0b1c68498f41a6772d80ac7c1e33c06c6ffa2ac1c27a07653e79d6f"}, - {file = "websockets-11.0.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:777354ee16f02f643a4c7f2b3eff8027a33c9861edc691a2003531f5da4f6bc8"}, - {file = "websockets-11.0.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8c82f11964f010053e13daafdc7154ce7385ecc538989a354ccc7067fd7028fd"}, - {file = "websockets-11.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3580dd9c1ad0701169e4d6fc41e878ffe05e6bdcaf3c412f9d559389d0c9e016"}, - {file = "websockets-11.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6f1a3f10f836fab6ca6efa97bb952300b20ae56b409414ca85bff2ad241d2a61"}, - {file = "websockets-11.0.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:df41b9bc27c2c25b486bae7cf42fccdc52ff181c8c387bfd026624a491c2671b"}, - {file = "websockets-11.0.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:279e5de4671e79a9ac877427f4ac4ce93751b8823f276b681d04b2156713b9dd"}, - {file = "websockets-11.0.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:1fdf26fa8a6a592f8f9235285b8affa72748dc12e964a5518c6c5e8f916716f7"}, - {file = "websockets-11.0.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:69269f3a0b472e91125b503d3c0b3566bda26da0a3261c49f0027eb6075086d1"}, - {file = "websockets-11.0.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:97b52894d948d2f6ea480171a27122d77af14ced35f62e5c892ca2fae9344311"}, - {file = "websockets-11.0.3-cp39-cp39-win32.whl", hash = "sha256:c7f3cb904cce8e1be667c7e6fef4516b98d1a6a0635a58a57528d577ac18a128"}, - {file = "websockets-11.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:c792ea4eabc0159535608fc5658a74d1a81020eb35195dd63214dcf07556f67e"}, - {file = "websockets-11.0.3-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:f2e58f2c36cc52d41f2659e4c0cbf7353e28c8c9e63e30d8c6d3494dc9fdedcf"}, - {file = "websockets-11.0.3-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:de36fe9c02995c7e6ae6efe2e205816f5f00c22fd1fbf343d4d18c3d5ceac2f5"}, - {file = "websockets-11.0.3-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0ac56b661e60edd453585f4bd68eb6a29ae25b5184fd5ba51e97652580458998"}, - {file = "websockets-11.0.3-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e052b8467dd07d4943936009f46ae5ce7b908ddcac3fda581656b1b19c083d9b"}, - {file = "websockets-11.0.3-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:42cc5452a54a8e46a032521d7365da775823e21bfba2895fb7b77633cce031bb"}, - {file = "websockets-11.0.3-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:e6316827e3e79b7b8e7d8e3b08f4e331af91a48e794d5d8b099928b6f0b85f20"}, - {file = "websockets-11.0.3-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8531fdcad636d82c517b26a448dcfe62f720e1922b33c81ce695d0edb91eb931"}, - {file = "websockets-11.0.3-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c114e8da9b475739dde229fd3bc6b05a6537a88a578358bc8eb29b4030fac9c9"}, - {file = "websockets-11.0.3-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e063b1865974611313a3849d43f2c3f5368093691349cf3c7c8f8f75ad7cb280"}, - {file = "websockets-11.0.3-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:92b2065d642bf8c0a82d59e59053dd2fdde64d4ed44efe4870fa816c1232647b"}, - {file = "websockets-11.0.3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0ee68fe502f9031f19d495dae2c268830df2760c0524cbac5d759921ba8c8e82"}, - {file = "websockets-11.0.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcacf2c7a6c3a84e720d1bb2b543c675bf6c40e460300b628bab1b1efc7c034c"}, - {file = "websockets-11.0.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b67c6f5e5a401fc56394f191f00f9b3811fe843ee93f4a70df3c389d1adf857d"}, - {file = "websockets-11.0.3-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1d5023a4b6a5b183dc838808087033ec5df77580485fc533e7dab2567851b0a4"}, - {file = "websockets-11.0.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:ed058398f55163a79bb9f06a90ef9ccc063b204bb346c4de78efc5d15abfe602"}, - {file = "websockets-11.0.3-py3-none-any.whl", hash = "sha256:6681ba9e7f8f3b19440921e99efbb40fc89f26cd71bf539e45d8c8a25c976dc6"}, - {file = "websockets-11.0.3.tar.gz", hash = "sha256:88fc51d9a26b10fc331be344f1781224a375b78488fc343620184e95a4b27016"}, -] - -[[package]] -name = "zipp" -version = "3.15.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.7" -files = [ - {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, - {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +python-versions = ">=3.8" +files = [ + {file = "websockets-12.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d554236b2a2006e0ce16315c16eaa0d628dab009c33b63ea03f41c6107958374"}, + {file = "websockets-12.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2d225bb6886591b1746b17c0573e29804619c8f755b5598d875bb4235ea639be"}, + {file = "websockets-12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:eb809e816916a3b210bed3c82fb88eaf16e8afcf9c115ebb2bacede1797d2547"}, + {file = "websockets-12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c588f6abc13f78a67044c6b1273a99e1cf31038ad51815b3b016ce699f0d75c2"}, + {file = "websockets-12.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5aa9348186d79a5f232115ed3fa9020eab66d6c3437d72f9d2c8ac0c6858c558"}, + {file = "websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6350b14a40c95ddd53e775dbdbbbc59b124a5c8ecd6fbb09c2e52029f7a9f480"}, + {file = "websockets-12.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:70ec754cc2a769bcd218ed8d7209055667b30860ffecb8633a834dde27d6307c"}, + {file = "websockets-12.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:6e96f5ed1b83a8ddb07909b45bd94833b0710f738115751cdaa9da1fb0cb66e8"}, + {file = "websockets-12.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:4d87be612cbef86f994178d5186add3d94e9f31cc3cb499a0482b866ec477603"}, + {file = "websockets-12.0-cp310-cp310-win32.whl", hash = "sha256:befe90632d66caaf72e8b2ed4d7f02b348913813c8b0a32fae1cc5fe3730902f"}, + {file = "websockets-12.0-cp310-cp310-win_amd64.whl", hash = "sha256:363f57ca8bc8576195d0540c648aa58ac18cf85b76ad5202b9f976918f4219cf"}, + {file = "websockets-12.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5d873c7de42dea355d73f170be0f23788cf3fa9f7bed718fd2830eefedce01b4"}, + {file = "websockets-12.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3f61726cae9f65b872502ff3c1496abc93ffbe31b278455c418492016e2afc8f"}, + {file = "websockets-12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed2fcf7a07334c77fc8a230755c2209223a7cc44fc27597729b8ef5425aa61a3"}, + {file = "websockets-12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e332c210b14b57904869ca9f9bf4ca32f5427a03eeb625da9b616c85a3a506c"}, + {file = "websockets-12.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5693ef74233122f8ebab026817b1b37fe25c411ecfca084b29bc7d6efc548f45"}, + {file = "websockets-12.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e9e7db18b4539a29cc5ad8c8b252738a30e2b13f033c2d6e9d0549b45841c04"}, + {file = "websockets-12.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6e2df67b8014767d0f785baa98393725739287684b9f8d8a1001eb2839031447"}, + {file = "websockets-12.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:bea88d71630c5900690fcb03161ab18f8f244805c59e2e0dc4ffadae0a7ee0ca"}, + {file = "websockets-12.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:dff6cdf35e31d1315790149fee351f9e52978130cef6c87c4b6c9b3baf78bc53"}, + {file = "websockets-12.0-cp311-cp311-win32.whl", hash = "sha256:3e3aa8c468af01d70332a382350ee95f6986db479ce7af14d5e81ec52aa2b402"}, + {file = "websockets-12.0-cp311-cp311-win_amd64.whl", hash = "sha256:25eb766c8ad27da0f79420b2af4b85d29914ba0edf69f547cc4f06ca6f1d403b"}, + {file = "websockets-12.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0e6e2711d5a8e6e482cacb927a49a3d432345dfe7dea8ace7b5790df5932e4df"}, + {file = "websockets-12.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:dbcf72a37f0b3316e993e13ecf32f10c0e1259c28ffd0a85cee26e8549595fbc"}, + {file = "websockets-12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:12743ab88ab2af1d17dd4acb4645677cb7063ef4db93abffbf164218a5d54c6b"}, + {file = "websockets-12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7b645f491f3c48d3f8a00d1fce07445fab7347fec54a3e65f0725d730d5b99cb"}, + {file = "websockets-12.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9893d1aa45a7f8b3bc4510f6ccf8db8c3b62120917af15e3de247f0780294b92"}, + {file = "websockets-12.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f38a7b376117ef7aff996e737583172bdf535932c9ca021746573bce40165ed"}, + {file = "websockets-12.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:f764ba54e33daf20e167915edc443b6f88956f37fb606449b4a5b10ba42235a5"}, + {file = "websockets-12.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:1e4b3f8ea6a9cfa8be8484c9221ec0257508e3a1ec43c36acdefb2a9c3b00aa2"}, + {file = "websockets-12.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9fdf06fd06c32205a07e47328ab49c40fc1407cdec801d698a7c41167ea45113"}, + {file = "websockets-12.0-cp312-cp312-win32.whl", hash = "sha256:baa386875b70cbd81798fa9f71be689c1bf484f65fd6fb08d051a0ee4e79924d"}, + {file = "websockets-12.0-cp312-cp312-win_amd64.whl", hash = "sha256:ae0a5da8f35a5be197f328d4727dbcfafa53d1824fac3d96cdd3a642fe09394f"}, + {file = "websockets-12.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5f6ffe2c6598f7f7207eef9a1228b6f5c818f9f4d53ee920aacd35cec8110438"}, + {file = "websockets-12.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9edf3fc590cc2ec20dc9d7a45108b5bbaf21c0d89f9fd3fd1685e223771dc0b2"}, + {file = "websockets-12.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8572132c7be52632201a35f5e08348137f658e5ffd21f51f94572ca6c05ea81d"}, + {file = "websockets-12.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:604428d1b87edbf02b233e2c207d7d528460fa978f9e391bd8aaf9c8311de137"}, + {file = "websockets-12.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1a9d160fd080c6285e202327aba140fc9a0d910b09e423afff4ae5cbbf1c7205"}, + {file = "websockets-12.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87b4aafed34653e465eb77b7c93ef058516cb5acf3eb21e42f33928616172def"}, + {file = "websockets-12.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b2ee7288b85959797970114deae81ab41b731f19ebcd3bd499ae9ca0e3f1d2c8"}, + {file = "websockets-12.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:7fa3d25e81bfe6a89718e9791128398a50dec6d57faf23770787ff441d851967"}, + {file = "websockets-12.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:a571f035a47212288e3b3519944f6bf4ac7bc7553243e41eac50dd48552b6df7"}, + {file = "websockets-12.0-cp38-cp38-win32.whl", hash = "sha256:3c6cc1360c10c17463aadd29dd3af332d4a1adaa8796f6b0e9f9df1fdb0bad62"}, + {file = "websockets-12.0-cp38-cp38-win_amd64.whl", hash = "sha256:1bf386089178ea69d720f8db6199a0504a406209a0fc23e603b27b300fdd6892"}, + {file = "websockets-12.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:ab3d732ad50a4fbd04a4490ef08acd0517b6ae6b77eb967251f4c263011a990d"}, + {file = "websockets-12.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a1d9697f3337a89691e3bd8dc56dea45a6f6d975f92e7d5f773bc715c15dde28"}, + {file = "websockets-12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1df2fbd2c8a98d38a66f5238484405b8d1d16f929bb7a33ed73e4801222a6f53"}, + {file = "websockets-12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23509452b3bc38e3a057382c2e941d5ac2e01e251acce7adc74011d7d8de434c"}, + {file = "websockets-12.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2e5fc14ec6ea568200ea4ef46545073da81900a2b67b3e666f04adf53ad452ec"}, + {file = "websockets-12.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:46e71dbbd12850224243f5d2aeec90f0aaa0f2dde5aeeb8fc8df21e04d99eff9"}, + {file = "websockets-12.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b81f90dcc6c85a9b7f29873beb56c94c85d6f0dac2ea8b60d995bd18bf3e2aae"}, + {file = "websockets-12.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:a02413bc474feda2849c59ed2dfb2cddb4cd3d2f03a2fedec51d6e959d9b608b"}, + {file = "websockets-12.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:bbe6013f9f791944ed31ca08b077e26249309639313fff132bfbf3ba105673b9"}, + {file = "websockets-12.0-cp39-cp39-win32.whl", hash = "sha256:cbe83a6bbdf207ff0541de01e11904827540aa069293696dd528a6640bd6a5f6"}, + {file = "websockets-12.0-cp39-cp39-win_amd64.whl", hash = "sha256:fc4e7fa5414512b481a2483775a8e8be7803a35b30ca805afa4998a84f9fd9e8"}, + {file = "websockets-12.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:248d8e2446e13c1d4326e0a6a4e9629cb13a11195051a73acf414812700badbd"}, + {file = "websockets-12.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f44069528d45a933997a6fef143030d8ca8042f0dfaad753e2906398290e2870"}, + {file = "websockets-12.0-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c4e37d36f0d19f0a4413d3e18c0d03d0c268ada2061868c1e6f5ab1a6d575077"}, + {file = "websockets-12.0-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d829f975fc2e527a3ef2f9c8f25e553eb7bc779c6665e8e1d52aa22800bb38b"}, + {file = "websockets-12.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:2c71bd45a777433dd9113847af751aae36e448bc6b8c361a566cb043eda6ec30"}, + {file = "websockets-12.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0bee75f400895aef54157b36ed6d3b308fcab62e5260703add87f44cee9c82a6"}, + {file = "websockets-12.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:423fc1ed29f7512fceb727e2d2aecb952c46aa34895e9ed96071821309951123"}, + {file = "websockets-12.0-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27a5e9964ef509016759f2ef3f2c1e13f403725a5e6a1775555994966a66e931"}, + {file = "websockets-12.0-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3181df4583c4d3994d31fb235dc681d2aaad744fbdbf94c4802485ececdecf2"}, + {file = "websockets-12.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:b067cb952ce8bf40115f6c19f478dc71c5e719b7fbaa511359795dfd9d1a6468"}, + {file = "websockets-12.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:00700340c6c7ab788f176d118775202aadea7602c5cc6be6ae127761c16d6b0b"}, + {file = "websockets-12.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e469d01137942849cff40517c97a30a93ae79917752b34029f0ec72df6b46399"}, + {file = "websockets-12.0-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffefa1374cd508d633646d51a8e9277763a9b78ae71324183693959cf94635a7"}, + {file = "websockets-12.0-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba0cab91b3956dfa9f512147860783a1829a8d905ee218a9837c18f683239611"}, + {file = "websockets-12.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2cb388a5bfb56df4d9a406783b7f9dbefb888c09b71629351cc6b036e9259370"}, + {file = "websockets-12.0-py3-none-any.whl", hash = "sha256:dc284bbc8d7c78a6c69e0c7325ab46ee5e40bb4d50e494d8131a07ef47500e9e"}, + {file = "websockets-12.0.tar.gz", hash = "sha256:81df9cbcbb6c260de1e007e58c011bfebe2dafc8435107b0537f393dd38c8b1b"}, ] -[package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] - [metadata] lock-version = "2.0" -python-versions = "^3.7" -content-hash = "607639f96e96896c454bc442373485b1eebdb3a50f2896cf208de542f9799989" +python-versions = "^3.8" +content-hash = "c60ff5594df0776ee7bd99528ed1f470d5c735bc03c1791d71b41dc9eefb4078" diff --git a/pyproject.toml b/pyproject.toml index 905fcb7..01117c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "elevenlabs" -version = "v0.3.0b0" +version = "1.0.0b0" description = "" readme = "README.md" authors = [] @@ -9,15 +9,16 @@ packages = [ ] [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" httpx = ">=0.21.2" ipython = ">=7.0" -pydantic = ">= 1.9.2, < 2.5.0" +pydantic = ">= 1.9.2" requests = ">=2.20" +typing_extensions = ">= 4.0.0" websockets = ">=11.0" [tool.poetry.dev-dependencies] -mypy = "0.971" +mypy = "^1.8.0" pytest = "^7.4.0" [build-system] diff --git a/src/elevenlabs/__init__.py b/src/elevenlabs/__init__.py index e10be74..361533c 100644 --- a/src/elevenlabs/__init__.py +++ b/src/elevenlabs/__init__.py @@ -1,38 +1,33 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - Accent, AddProjectResponseModel, AddPronunciationDictionaryResponseModel, AddVoiceResponseModel, - Age, AudioNativeCreateProjectResponseModel, AudioNativeGetEmbedCodeResponseModel, ChapterResponseModel, - ChapterResponseModelState, ChapterSnapshotResponseModel, ChapterSnapshotsResponseModel, ChapterStatisticsResponseModel, Currency, - ExtendedSubscriptionResponseModelCurrency, + ExtendedSubscriptionResponseModel, FeedbackItem, FineTuningResponseModel, - FinetunigState, - Gender, + FinetuningState, GetChaptersResponseModel, + GetHistoryResponseModel, GetProjectsResponseModel, GetPronunciationDictionaryMetadataResponseModel, GetVoicesResponseModel, - History, HistoryItem, - HistoryItemState, HttpValidationError, InvoiceResponseModel, - InvoiceResponseModelCurrency, + ItemState, LanguageResponseModel, ManualVerificationFileResponseModel, ManualVerificationResponseModel, - Model, + ModelResponse, ProjectExtendedResponseModel, ProjectResponseModel, ProjectSnapshotResponseModel, @@ -41,82 +36,54 @@ PronunciationDictionaryVersionLocatorDbModel, RecordingResponseModel, ReviewStatus, - Subscription, + SampleResponseModel, + State, SubscriptionResponse, SubscriptionStatus, - User, + UserResponse, ValidationError, ValidationErrorLocItem, VerificationAttemptResponseModel, VoiceCategory, VoiceResponse, - VoiceSample, VoiceSettings, VoiceSharingResponseModel, VoiceSharingState, ) from .errors import UnprocessableEntityError -from .resources import ( - audio_native, - history, - models, - projects, - pronunciation_dictionary, - samples, - text_to_speech, - user, - voices as voices_client, -) -from .environment import ElevenLabsEnvironment +from . import audio_native, history, models, projects, pronunciation_dictionary, samples, text_to_speech, user, voices from .environment import ElevenLabsEnvironment -from .clone import clone -from .generate import generate from .play import play, save, stream -from .voice import Voice, VoiceClone, voices __all__ = [ - "clone", - "generate", - "Model", - "play", - "save", - "stream", - "Voice", - "VoiceClone", - "voices_client", - "Accent", "AddProjectResponseModel", "AddPronunciationDictionaryResponseModel", "AddVoiceResponseModel", - "Age", "AudioNativeCreateProjectResponseModel", "AudioNativeGetEmbedCodeResponseModel", "ChapterResponseModel", - "ChapterResponseModelState", "ChapterSnapshotResponseModel", "ChapterSnapshotsResponseModel", "ChapterStatisticsResponseModel", "Currency", "ElevenLabsEnvironment", - "ExtendedSubscriptionResponseModelCurrency", + "ExtendedSubscriptionResponseModel", "FeedbackItem", "FineTuningResponseModel", - "FinetunigState", - "Gender", + "FinetuningState", "GetChaptersResponseModel", + "GetHistoryResponseModel", "GetProjectsResponseModel", "GetPronunciationDictionaryMetadataResponseModel", "GetVoicesResponseModel", - "History", "HistoryItem", - "HistoryItemState", "HttpValidationError", "InvoiceResponseModel", - "InvoiceResponseModelCurrency", + "ItemState", "LanguageResponseModel", "ManualVerificationFileResponseModel", "ManualVerificationResponseModel", - "Model", + "ModelResponse", "ProjectExtendedResponseModel", "ProjectResponseModel", "ProjectSnapshotResponseModel", @@ -125,26 +92,29 @@ "PronunciationDictionaryVersionLocatorDbModel", "RecordingResponseModel", "ReviewStatus", - "Subscription", + "SampleResponseModel", + "State", "SubscriptionResponse", "SubscriptionStatus", "UnprocessableEntityError", - "User", + "UserResponse", "ValidationError", "ValidationErrorLocItem", "VerificationAttemptResponseModel", "VoiceCategory", "VoiceResponse", - "VoiceSample", "VoiceSettings", "VoiceSharingResponseModel", "VoiceSharingState", "audio_native", "history", "models", + "play", "projects", "pronunciation_dictionary", "samples", + "save", + "stream", "text_to_speech", "user", "voices", diff --git a/src/elevenlabs/resources/audio_native/__init__.py b/src/elevenlabs/audio_native/__init__.py similarity index 100% rename from src/elevenlabs/resources/audio_native/__init__.py rename to src/elevenlabs/audio_native/__init__.py diff --git a/src/elevenlabs/audio_native/client.py b/src/elevenlabs/audio_native/client.py new file mode 100644 index 0000000..479bd9e --- /dev/null +++ b/src/elevenlabs/audio_native/client.py @@ -0,0 +1,454 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel +from ..types.audio_native_get_embed_code_response_model import AudioNativeGetEmbedCodeResponseModel +from ..types.http_validation_error import HttpValidationError + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AudioNativeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + image: str, + author: str, + small: bool, + text_color: str, + background_color: str, + sessionization: int, + voice_id: str, + model_id: str, + file: core.File, + auto_convert: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeCreateProjectResponseModel: + """ + Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet. + + Parameters: + - name: str. Project name. + + - image: str. Image URL used in the player. If not provided, default image set in the Player settings is used. + + - author: str. Author used in the player. If not provided, default author set in the Player settings is used. + + - small: bool. Whether to use small player or not. If not provided, default value set in the Player settings is used. + + - text_color: str. Text color used in the player. If not provided, default text color set in the Player settings is used. + + - background_color: str. Background color used in the player. If not provided, default background color set in the Player settings is used. + + - sessionization: int. Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + - voice_id: str. Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + - model_id: str. TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + - file: core.File. See core.File for more documentation + + - auto_convert: bool. Whether to auto convert the project to audio or not. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "image": image, + "author": author, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + } + ) + ) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "image": image, + "author": author, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + } + ) + ), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"file": file})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeCreateProjectResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_embed_code( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioNativeGetEmbedCodeResponseModel: + """ + Get the HTML snippet to embed the AudioNative player into a webpage. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.get_embed_code() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native/get-embed-code"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeGetEmbedCodeResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_project_embed_code( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioNativeGetEmbedCodeResponseModel: + """ + Get the HTML snippet to embed the AudioNative player into a webpage. The embedded player will not convert content from the webpage but instead play the specified project + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.get_project_embed_code( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/audio-native/{jsonable_encoder(project_id)}/get-embed-code", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeGetEmbedCodeResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncAudioNativeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + image: str, + author: str, + small: bool, + text_color: str, + background_color: str, + sessionization: int, + voice_id: str, + model_id: str, + file: core.File, + auto_convert: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeCreateProjectResponseModel: + """ + Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet. + + Parameters: + - name: str. Project name. + + - image: str. Image URL used in the player. If not provided, default image set in the Player settings is used. + + - author: str. Author used in the player. If not provided, default author set in the Player settings is used. + + - small: bool. Whether to use small player or not. If not provided, default value set in the Player settings is used. + + - text_color: str. Text color used in the player. If not provided, default text color set in the Player settings is used. + + - background_color: str. Background color used in the player. If not provided, default background color set in the Player settings is used. + + - sessionization: int. Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + - voice_id: str. Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + - model_id: str. TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + - file: core.File. See core.File for more documentation + + - auto_convert: bool. Whether to auto convert the project to audio or not. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "image": image, + "author": author, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + } + ) + ) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "image": image, + "author": author, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + } + ) + ), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"file": file})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeCreateProjectResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_embed_code( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioNativeGetEmbedCodeResponseModel: + """ + Get the HTML snippet to embed the AudioNative player into a webpage. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.audio_native.get_embed_code() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native/get-embed-code"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeGetEmbedCodeResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_project_embed_code( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioNativeGetEmbedCodeResponseModel: + """ + Get the HTML snippet to embed the AudioNative player into a webpage. The embedded player will not convert content from the webpage but instead play the specified project + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.audio_native.get_project_embed_code( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/audio-native/{jsonable_encoder(project_id)}/get-embed-code", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AudioNativeGetEmbedCodeResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/client.py b/src/elevenlabs/base_client.py similarity index 52% rename from src/elevenlabs/client.py rename to src/elevenlabs/base_client.py index 7730ec8..430c2ed 100644 --- a/src/elevenlabs/client.py +++ b/src/elevenlabs/base_client.py @@ -1,25 +1,47 @@ # This file was auto-generated by Fern from our API Definition. +import os import typing import httpx -import os -from .core.api_error import ApiError +from .audio_native.client import AsyncAudioNativeClient, AudioNativeClient from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .environment import ElevenLabsEnvironment -from .resources.audio_native.client import AsyncAudioNativeClient, AudioNativeClient -from .resources.history.client import AsyncHistoryClient, HistoryClient -from .resources.models.client import AsyncModelsClient, ModelsClient -from .resources.projects.client import AsyncProjectsClient, ProjectsClient -from .resources.pronunciation_dictionary.client import AsyncPronunciationDictionaryClient, PronunciationDictionaryClient -from .resources.samples.client import AsyncSamplesClient, SamplesClient -from .resources.text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient -from .resources.user.client import AsyncUserClient, UserClient -from .resources.voices.client import AsyncVoicesClient, VoicesClient - - -class ElevenLabs: +from .history.client import AsyncHistoryClient, HistoryClient +from .models.client import AsyncModelsClient, ModelsClient +from .projects.client import AsyncProjectsClient, ProjectsClient +from .pronunciation_dictionary.client import AsyncPronunciationDictionaryClient, PronunciationDictionaryClient +from .samples.client import AsyncSamplesClient, SamplesClient +from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient +from .user.client import AsyncUserClient, UserClient +from .voices.client import AsyncVoicesClient, VoicesClient + + +class BaseElevenLabs: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. + + Parameters: + - base_url: typing.Optional[str]. The base url to use for requests from the client. + + - environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + Defaults to ElevenLabsEnvironment.PRODUCTION + + - api_key: typing.Optional[str]. + + - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds. + + - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + def __init__( self, *, @@ -29,17 +51,9 @@ def __init__( timeout: typing.Optional[float] = 60, httpx_client: typing.Optional[httpx.Client] = None ): - """ - Args: - base_url typing.Optional[str]. Override the base URL. - environment ElevenLabsEnvironment. Defaults to PRODUCTION. - api_key typing.Optional[str]. Defaults to ELEVEN_API_KEY environment variable. - timeout typing.Optional[float]. Defaults to 60 seconds. - httpx_client typing.Optional[httpx.AsyncClient]. Override the httpx client. - """ self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), - xi_api_key=api_key, + api_key=api_key, httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client, ) self.history = HistoryClient(client_wrapper=self._client_wrapper) @@ -53,7 +67,30 @@ def __init__( self.pronunciation_dictionary = PronunciationDictionaryClient(client_wrapper=self._client_wrapper) -class AsyncElevenLabs: +class AsyncBaseElevenLabs: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. + + Parameters: + - base_url: typing.Optional[str]. The base url to use for requests from the client. + + - environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + Defaults to ElevenLabsEnvironment.PRODUCTION + + - api_key: typing.Optional[str]. + + - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds. + + - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + def __init__( self, *, @@ -62,18 +99,10 @@ def __init__( api_key: typing.Optional[str] = os.getenv("ELEVEN_API_KEY"), timeout: typing.Optional[float] = 60, httpx_client: typing.Optional[httpx.AsyncClient] = None - ): - """ - Args: - base_url typing.Optional[str]. Override the base URL. - environment ElevenLabsEnvironment. Defaults to PRODUCTION. - api_key typing.Optional[str]. Defaults to ELEVEN_API_KEY environment variable. - timeout typing.Optional[float]. Defaults to 60 seconds. - httpx_client typing.Optional[httpx.AsyncClient]. Override the httpx client. - """ + ): self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), - xi_api_key=api_key, + api_key=api_key, httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client, ) self.history = AsyncHistoryClient(client_wrapper=self._client_wrapper) diff --git a/src/elevenlabs/clone.py b/src/elevenlabs/clone.py deleted file mode 100644 index 01fd0ff..0000000 --- a/src/elevenlabs/clone.py +++ /dev/null @@ -1,26 +0,0 @@ -import json -import os -from typing import Dict, List, Optional - -from .client import ElevenLabs -from .voice import Voice - - -def clone( - name: str, - api_key: Optional[str] = os.getenv("ELEVEN_API_KEY"), - description: str = "", - files: List[str] = [], - labels: Optional[Dict[str, str]] = dict(), -) -> Voice: - client = ElevenLabs(api_key=api_key) - add_voice_response = client.voices.add( - name=name, - description=description, - files=[open(file, 'rb') for file in files], - labels=str(json.dumps(labels or {})) - ) - voice = client.voices.get(voice_id=add_voice_response.voice_id) - return Voice( - **voice.dict() - ) \ No newline at end of file diff --git a/src/elevenlabs/core/__init__.py b/src/elevenlabs/core/__init__.py index 2414955..b3e43c2 100644 --- a/src/elevenlabs/core/__init__.py +++ b/src/elevenlabs/core/__init__.py @@ -3,14 +3,22 @@ from .api_error import ApiError from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper from .datetime_utils import serialize_datetime +from .file import File, convert_file_dict_to_httpx_tuples +from .http_client import AsyncHttpClient, HttpClient from .jsonable_encoder import jsonable_encoder from .remove_none_from_dict import remove_none_from_dict +from .request_options import RequestOptions __all__ = [ "ApiError", "AsyncClientWrapper", + "AsyncHttpClient", "BaseClientWrapper", + "File", + "HttpClient", + "RequestOptions", "SyncClientWrapper", + "convert_file_dict_to_httpx_tuples", "jsonable_encoder", "remove_none_from_dict", "serialize_datetime", diff --git a/src/elevenlabs/core/client_wrapper.py b/src/elevenlabs/core/client_wrapper.py index 5b2d12e..4a94da5 100644 --- a/src/elevenlabs/core/client_wrapper.py +++ b/src/elevenlabs/core/client_wrapper.py @@ -4,16 +4,22 @@ import httpx +from .http_client import AsyncHttpClient, HttpClient + class BaseClientWrapper: - def __init__(self, *, xi_api_key: typing.Optional[str] = None, base_url: str): - self._xi_api_key = xi_api_key + def __init__(self, *, api_key: typing.Optional[str] = None, base_url: str): + self._api_key = api_key self._base_url = base_url def get_headers(self) -> typing.Dict[str, str]: - headers: typing.Dict[str, str] = {"X-Fern-Language": "Python"} - if self._xi_api_key is not None: - headers["xi-api-key"] = self._xi_api_key + headers: typing.Dict[str, str] = { + "X-Fern-Language": "Python", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "1.0.0b0", + } + if self._api_key is not None: + headers["xi-api-key"] = self._api_key return headers def get_base_url(self) -> str: @@ -21,12 +27,12 @@ def get_base_url(self) -> str: class SyncClientWrapper(BaseClientWrapper): - def __init__(self, *, xi_api_key: typing.Optional[str] = None, base_url: str, httpx_client: httpx.Client): - super().__init__(xi_api_key=xi_api_key, base_url=base_url) - self.httpx_client = httpx_client + def __init__(self, *, api_key: typing.Optional[str] = None, base_url: str, httpx_client: httpx.Client): + super().__init__(api_key=api_key, base_url=base_url) + self.httpx_client = HttpClient(httpx_client=httpx_client) class AsyncClientWrapper(BaseClientWrapper): - def __init__(self, *, xi_api_key: typing.Optional[str] = None, base_url: str, httpx_client: httpx.AsyncClient): - super().__init__(xi_api_key=xi_api_key, base_url=base_url) - self.httpx_client = httpx_client + def __init__(self, *, api_key: typing.Optional[str] = None, base_url: str, httpx_client: httpx.AsyncClient): + super().__init__(api_key=api_key, base_url=base_url) + self.httpx_client = AsyncHttpClient(httpx_client=httpx_client) diff --git a/src/elevenlabs/core/file.py b/src/elevenlabs/core/file.py index a6e2e5e..cb0d40b 100644 --- a/src/elevenlabs/core/file.py +++ b/src/elevenlabs/core/file.py @@ -1,19 +1,38 @@ -from typing import ( - IO, - Mapping, - Optional, - Tuple, - Union, -) +# This file was auto-generated by Fern from our API Definition. -FileContent = Union[IO[bytes], bytes, str] -FileType = Union[ +import typing + +# File typing inspired by the flexibility of types within the httpx library +# https://github.com/encode/httpx/blob/master/httpx/_types.py +FileContent = typing.Union[typing.IO[bytes], bytes, str] +File = typing.Union[ # file (or bytes) FileContent, # (filename, file (or bytes)) - Tuple[Optional[str], FileContent], + typing.Tuple[typing.Optional[str], FileContent], # (filename, file (or bytes), content_type) - Tuple[Optional[str], FileContent, Optional[str]], + typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]], # (filename, file (or bytes), content_type, headers) - Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], -] \ No newline at end of file + typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]], +] + + +def convert_file_dict_to_httpx_tuples( + d: typing.Dict[str, typing.Union[File, typing.List[File]]] +) -> typing.List[typing.Tuple[str, File]]: + """ + The format we use is a list of tuples, where the first element is the + name of the file and the second is the file object. Typically HTTPX wants + a dict, but to be able to send lists of files, you have to use the list + approach (which also works for non-lists) + https://github.com/encode/httpx/pull/1032 + """ + + httpx_tuples = [] + for key, file_like in d.items(): + if isinstance(file_like, list): + for file_like_item in file_like: + httpx_tuples.append((key, file_like_item)) + else: + httpx_tuples.append((key, file_like)) + return httpx_tuples diff --git a/src/elevenlabs/core/http_client.py b/src/elevenlabs/core/http_client.py new file mode 100644 index 0000000..fbbbc15 --- /dev/null +++ b/src/elevenlabs/core/http_client.py @@ -0,0 +1,125 @@ +# This file was auto-generated by Fern from our API Definition. + +import asyncio +import email.utils +import re +import time +import typing +from functools import wraps +from random import random + +import httpx + +INITIAL_RETRY_DELAY_SECONDS = 0.5 +MAX_RETRY_DELAY_SECONDS = 10 +MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 + + +def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait. + + Inspired by the urllib3 retry implementation. + """ + retry_after_ms = response_headers.get("retry-after-ms") + if retry_after_ms is not None: + try: + return int(retry_after_ms) / 1000 if retry_after_ms > 0 else 0 + except Exception: + pass + + retry_after = response_headers.get("retry-after") + if retry_after is None: + return None + + # Attempt to parse the header as an int. + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = float(retry_after) + # Fallback to parsing it as a date. + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + return None + if retry_date_tuple[9] is None: # Python 2 + # Assume UTC if no timezone was specified + # On Python2.7, parsedate_tz returns None for a timezone offset + # instead of 0 if no timezone is given, where mktime_tz treats + # a None timezone offset as local time. + retry_date_tuple = retry_date_tuple[:9] + (0,) + retry_date_tuple[10:] + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + if seconds < 0: + seconds = 0 + + return seconds + + +def _retry_timeout(response: httpx.Response, retries: int) -> float: + """ + Determine the amount of time to wait before retrying a request. + This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff + with a jitter to determine the number of seconds to wait. + """ + + # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + retry_after = _parse_retry_after(response.headers) + if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: + return retry_after + + # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. + retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + + # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. + timeout = retry_delay * (1 - 0.25 * random()) + return timeout if timeout >= 0 else 0 + + +def _should_retry(response: httpx.Response) -> bool: + retriable_400s = [429, 408, 409] + return response.status_code >= 500 or response.status_code in retriable_400s + + +class HttpClient: + def __init__(self, *, httpx_client: httpx.Client): + self.httpx_client = httpx_client + + # Ensure that the signature of the `request` method is the same as the `httpx.Client.request` method + @wraps(httpx.Client.request) + def request( + self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any + ) -> httpx.Response: + response = self.httpx_client.request(*args, **kwargs) + if _should_retry(response=response): + if max_retries > retries: + time.sleep(_retry_timeout(response=response, retries=retries)) + return self.request(max_retries=max_retries, retries=retries + 1, *args, **kwargs) + return response + + @wraps(httpx.Client.stream) + def stream(self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any) -> typing.Any: + return self.httpx_client.stream(*args, **kwargs) + + +class AsyncHttpClient: + def __init__(self, *, httpx_client: httpx.AsyncClient): + self.httpx_client = httpx_client + + # Ensure that the signature of the `request` method is the same as the `httpx.Client.request` method + @wraps(httpx.AsyncClient.request) + async def request( + self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any + ) -> httpx.Response: + response = await self.httpx_client.request(*args, **kwargs) + if _should_retry(response=response): + if max_retries > retries: + await asyncio.sleep(_retry_timeout(response=response, retries=retries)) + return await self.request(max_retries=max_retries, retries=retries + 1, *args, **kwargs) + return response + + @wraps(httpx.AsyncClient.request) + async def stream( + self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any + ) -> typing.Any: + return self.httpx_client.stream(*args, **kwargs) diff --git a/src/elevenlabs/core/request_options.py b/src/elevenlabs/core/request_options.py new file mode 100644 index 0000000..cd6f27a --- /dev/null +++ b/src/elevenlabs/core/request_options.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +try: + from typing import NotRequired # type: ignore +except ImportError: + from typing_extensions import NotRequired # type: ignore + + +class RequestOptions(typing.TypedDict): + """ + Additional options for request-specific configuration when calling APIs via the SDK. + This is used primarily as an optional final parameter for service functions. + + Attributes: + - timeout_in_seconds: int. The number of seconds to await an API call before timing out. + + - max_retries: int. The max number of retries to attempt if the API call fails. + + - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict + + - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict + + - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict + """ + + timeout_in_seconds: NotRequired[int] + max_retries: NotRequired[int] + additional_headers: NotRequired[typing.Dict[str, typing.Any]] + additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] + additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] diff --git a/src/elevenlabs/generate.py b/src/elevenlabs/generate.py deleted file mode 100644 index fc51f01..0000000 --- a/src/elevenlabs/generate.py +++ /dev/null @@ -1,57 +0,0 @@ -import re -import os - -from typing import Iterator, Optional, Union - -from .tts import TTS -from .types import VoiceSettings, Model -from .voice import Voice, voices - - -DEFAULT_VOICE = Voice( - voice_id="EXAVITQu4vr4xnSDxMaL", - name="Bella", - settings=VoiceSettings( - stability=0.71, similarity_boost=0.5, style=0.0, use_speaker_boost=True - ), -) - - -def is_voice_id(val: str) -> bool: - return bool(re.match(r"^[a-zA-Z0-9]{20}$", val)) - - -def generate( - text: Union[str, Iterator[str]], - api_key: Optional[str] = os.getenv("ELEVEN_API_KEY"), - voice: Union[str, Voice] = DEFAULT_VOICE, - model: Union[str, Model] = "eleven_monolingual_v1", - stream: bool = False, - latency: int = 1, - stream_chunk_size: int = 2048, - output_format: Optional[str] = "mp3_44100_128", -) -> Union[bytes, Iterator[bytes]]: - - if isinstance(voice, str): - voice_str = voice - # If voice is valid voice_id, use it - if is_voice_id(voice): - voice = Voice(voice_id=voice) - else: - voice = next((v for v in voices() if v.name == voice_str), None) # type: ignore # noqa E501 - - # Raise error if voice not found - if not voice: - raise ValueError(f"Voice '{voice_str}' not found.") - - if isinstance(model, str): - model = Model(model_id=model) # type: ignore - - if stream: - if isinstance(text, str): - return TTS.generate_stream(text, voice, model, stream_chunk_size, api_key=api_key, latency=latency, output_format=output_format) # type: ignore - elif isinstance(text, Iterator): - return TTS.generate_stream_input(text, voice, model, api_key=api_key) # type: ignore - else: - assert isinstance(text, str) - return TTS.generate(text, voice, model, api_key=api_key) # type: ignore diff --git a/src/elevenlabs/resources/history/__init__.py b/src/elevenlabs/history/__init__.py similarity index 100% rename from src/elevenlabs/resources/history/__init__.py rename to src/elevenlabs/history/__init__.py diff --git a/src/elevenlabs/history/client.py b/src/elevenlabs/history/client.py new file mode 100644 index 0000000..1a74e90 --- /dev/null +++ b/src/elevenlabs/history/client.py @@ -0,0 +1,565 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.get_history_response_model import GetHistoryResponseModel +from ..types.history_item import HistoryItem +from ..types.http_validation_error import HttpValidationError + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class HistoryClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_all( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetHistoryResponseModel: + """ + Returns metadata about all your generated audio. + + Parameters: + - page_size: typing.Optional[int]. How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + - start_after_history_item_id: typing.Optional[str]. After which history_item_id to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.get_all() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history"), + params=jsonable_encoder( + remove_none_from_dict( + { + "page_size": page_size, + "start_after_history_item_id": start_after_history_item_id, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetHistoryResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get(self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HistoryItem: + """ + Returns information about an history item by its ID. + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.get( + history_item_id="history_item_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(HistoryItem, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete(self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a history item by its ID + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.delete( + history_item_id="history_item_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Returns the audio of an history item. + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + with self._client_wrapper.httpx_client.stream( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}/audio" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) as _response: + if 200 <= _response.status_code < 300: + for _chunk in _response.iter_bytes(): + yield _chunk + return + _response.read() + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def download( + self, *, history_item_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters: + - history_item_ids: typing.Sequence[str]. A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.download( + history_item_ids=["history_item_ids"], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder({"history_item_ids": history_item_ids}) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder({"history_item_ids": history_item_ids}), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncHistoryClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_all( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetHistoryResponseModel: + """ + Returns metadata about all your generated audio. + + Parameters: + - page_size: typing.Optional[int]. How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + - start_after_history_item_id: typing.Optional[str]. After which history_item_id to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.history.get_all() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history"), + params=jsonable_encoder( + remove_none_from_dict( + { + "page_size": page_size, + "start_after_history_item_id": start_after_history_item_id, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetHistoryResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HistoryItem: + """ + Returns information about an history item by its ID. + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.history.get( + history_item_id="history_item_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(HistoryItem, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a history item by its ID + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.history.delete( + history_item_id="history_item_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Returns the audio of an history item. + + Parameters: + - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + async with self._client_wrapper.httpx_client.stream( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/history/{jsonable_encoder(history_item_id)}/audio" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) as _response: + if 200 <= _response.status_code < 300: + async for _chunk in _response.aiter_bytes(): + yield _chunk + return + await _response.aread() + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def download( + self, *, history_item_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters: + - history_item_ids: typing.Sequence[str]. A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.history.download( + history_item_ids=["history_item_ids"], + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder({"history_item_ids": history_item_ids}) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder({"history_item_ids": history_item_ids}), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/models/__init__.py b/src/elevenlabs/models/__init__.py similarity index 100% rename from src/elevenlabs/resources/models/__init__.py rename to src/elevenlabs/models/__init__.py diff --git a/src/elevenlabs/models/client.py b/src/elevenlabs/models/client.py new file mode 100644 index 0000000..ddd018b --- /dev/null +++ b/src/elevenlabs/models/client.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError +from ..types.model_response import ModelResponse + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ModelsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[ModelResponse]: + """ + Gets a list of available models. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.models.get_all() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/models"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.List[ModelResponse], _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncModelsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[ModelResponse]: + """ + Gets a list of available models. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.models.get_all() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/models"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.List[ModelResponse], _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/projects/resources/__init__.py b/src/elevenlabs/projects/__init__.py similarity index 100% rename from src/elevenlabs/resources/projects/resources/__init__.py rename to src/elevenlabs/projects/__init__.py diff --git a/src/elevenlabs/resources/projects/resources/chapters/resources/__init__.py b/src/elevenlabs/projects/chapters/__init__.py similarity index 100% rename from src/elevenlabs/resources/projects/resources/chapters/resources/__init__.py rename to src/elevenlabs/projects/chapters/__init__.py diff --git a/src/elevenlabs/projects/chapters/client.py b/src/elevenlabs/projects/chapters/client.py new file mode 100644 index 0000000..bf00edb --- /dev/null +++ b/src/elevenlabs/projects/chapters/client.py @@ -0,0 +1,479 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.jsonable_encoder import jsonable_encoder +from ...core.remove_none_from_dict import remove_none_from_dict +from ...core.request_options import RequestOptions +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.chapter_response_model import ChapterResponseModel +from ...types.get_chapters_response_model import GetChaptersResponseModel +from ...types.http_validation_error import HttpValidationError +from .snapshots.client import AsyncSnapshotsClient, SnapshotsClient + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ChaptersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + self.snapshots = SnapshotsClient(client_wrapper=self._client_wrapper) + + def get_all( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetChaptersResponseModel: + """ + Returns a list of your chapters for a project together and its metadata. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.chapters.get_all( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/chapters" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetChaptersResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterResponseModel: + """ + Returns information about a specific chapter. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.chapters.get( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ChapterResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a chapter by its chapter_id. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.chapters.delete( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Starts conversion of a specific chapter. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.chapters.convert( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/convert", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncChaptersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + self.snapshots = AsyncSnapshotsClient(client_wrapper=self._client_wrapper) + + async def get_all( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetChaptersResponseModel: + """ + Returns a list of your chapters for a project together and its metadata. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.chapters.get_all( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/chapters" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetChaptersResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterResponseModel: + """ + Returns information about a specific chapter. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.chapters.get( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ChapterResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a chapter by its chapter_id. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.chapters.delete( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Starts conversion of a specific chapter. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.chapters.convert( + project_id="project_id", + chapter_id="chapter_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/convert", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/projects/resources/chapters/resources/snapshots/__init__.py b/src/elevenlabs/projects/chapters/snapshots/__init__.py similarity index 100% rename from src/elevenlabs/resources/projects/resources/chapters/resources/snapshots/__init__.py rename to src/elevenlabs/projects/chapters/snapshots/__init__.py diff --git a/src/elevenlabs/resources/projects/resources/chapters/resources/snapshots/client.py b/src/elevenlabs/projects/chapters/snapshots/client.py similarity index 51% rename from src/elevenlabs/resources/projects/resources/chapters/resources/snapshots/client.py rename to src/elevenlabs/projects/chapters/snapshots/client.py index cd9dd57..60a43f6 100644 --- a/src/elevenlabs/resources/projects/resources/chapters/resources/snapshots/client.py +++ b/src/elevenlabs/projects/chapters/snapshots/client.py @@ -4,11 +4,14 @@ import urllib.parse from json.decoder import JSONDecodeError -from .......core.api_error import ApiError -from .......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .......errors.unprocessable_entity_error import UnprocessableEntityError -from .......types.chapter_snapshots_response_model import ChapterSnapshotsResponseModel -from .......types.http_validation_error import HttpValidationError +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.jsonable_encoder import jsonable_encoder +from ....core.remove_none_from_dict import remove_none_from_dict +from ....core.request_options import RequestOptions +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.chapter_snapshots_response_model import ChapterSnapshotsResponseModel +from ....types.http_validation_error import HttpValidationError try: import pydantic.v1 as pydantic # type: ignore @@ -20,7 +23,9 @@ class SnapshotsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper - def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsResponseModel: + def get_all( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterSnapshotsResponseModel: """ Gets information about all the snapshots of a chapter, each snapshot corresponds can be downloaded as audio. Whenever a chapter is converted a snapshot will be automatically created. @@ -28,6 +33,8 @@ def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsResponseM - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. --- from elevenlabs.client import ElevenLabs @@ -35,17 +42,32 @@ def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsResponseM api_key="YOUR_API_KEY", ) client.projects.chapters.snapshots.get_all( - project_id="string", - chapter_id="string", + project_id="project_id", + chapter_id="chapter_id", ) """ _response = self._client_wrapper.httpx_client.request( "GET", urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}/snapshots" + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) if 200 <= _response.status_code < 300: return pydantic.parse_obj_as(ChapterSnapshotsResponseModel, _response.json()) # type: ignore @@ -57,7 +79,14 @@ def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsResponseM raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def stream(self, project_id: str, chapter_id: str, chapter_snapshot_id: str) -> typing.Iterator[bytes]: + def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: """ Stream the audio from a chapter snapshot. Use GET /v1/projects/{project_id}/chapters/{chapter_id}/snapshots to return the chapter snapshots of a chapter. @@ -67,15 +96,34 @@ def stream(self, project_id: str, chapter_id: str, chapter_snapshot_id: str) -> - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - chapter_snapshot_id: str. The chapter_snapshot_id of the chapter snapshot. You can query GET /v1/projects/{project_id}/chapters/{chapter_id}/snapshots to the all available snapshots for a chapter. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ with self._client_wrapper.httpx_client.stream( "POST", urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", - f"v1/projects/{project_id}/chapters/{chapter_id}/snapshots/{chapter_snapshot_id}/stream", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}/stream", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: for _chunk in _response.iter_bytes(): @@ -93,7 +141,9 @@ class AsyncSnapshotsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper - async def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsResponseModel: + async def get_all( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterSnapshotsResponseModel: """ Gets information about all the snapshots of a chapter, each snapshot corresponds can be downloaded as audio. Whenever a chapter is converted a snapshot will be automatically created. @@ -101,6 +151,8 @@ async def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsRes - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. --- from elevenlabs.client import AsyncElevenLabs @@ -108,17 +160,32 @@ async def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsRes api_key="YOUR_API_KEY", ) await client.projects.chapters.snapshots.get_all( - project_id="string", - chapter_id="string", + project_id="project_id", + chapter_id="chapter_id", ) """ _response = await self._client_wrapper.httpx_client.request( "GET", urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}/snapshots" + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) if 200 <= _response.status_code < 300: return pydantic.parse_obj_as(ChapterSnapshotsResponseModel, _response.json()) # type: ignore @@ -130,7 +197,14 @@ async def get_all(self, project_id: str, chapter_id: str) -> ChapterSnapshotsRes raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def stream(self, project_id: str, chapter_id: str, chapter_snapshot_id: str) -> typing.AsyncIterator[bytes]: + async def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: """ Stream the audio from a chapter snapshot. Use GET /v1/projects/{project_id}/chapters/{chapter_id}/snapshots to return the chapter snapshots of a chapter. @@ -140,15 +214,34 @@ async def stream(self, project_id: str, chapter_id: str, chapter_snapshot_id: st - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - chapter_snapshot_id: str. The chapter_snapshot_id of the chapter snapshot. You can query GET /v1/projects/{project_id}/chapters/{chapter_id}/snapshots to the all available snapshots for a chapter. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ async with self._client_wrapper.httpx_client.stream( "POST", urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", - f"v1/projects/{project_id}/chapters/{chapter_id}/snapshots/{chapter_snapshot_id}/stream", + f"v1/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}/stream", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: async for _chunk in _response.aiter_bytes(): diff --git a/src/elevenlabs/projects/client.py b/src/elevenlabs/projects/client.py new file mode 100644 index 0000000..4c3b24f --- /dev/null +++ b/src/elevenlabs/projects/client.py @@ -0,0 +1,1024 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_project_response_model import AddProjectResponseModel +from ..types.get_projects_response_model import GetProjectsResponseModel +from ..types.http_validation_error import HttpValidationError +from ..types.project_extended_response_model import ProjectExtendedResponseModel +from ..types.project_snapshots_response_model import ProjectSnapshotsResponseModel +from ..types.pronunciation_dictionary_version_locator_db_model import PronunciationDictionaryVersionLocatorDbModel +from .chapters.client import AsyncChaptersClient, ChaptersClient + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProjectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + self.chapters = ChaptersClient(client_wrapper=self._client_wrapper) + + def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetProjectsResponseModel: + """ + Returns a list of your projects together and its metadata. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.get_all() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetProjectsResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def add( + self, + *, + name: str, + from_url: str, + from_document: typing.Optional[core.File] = None, + default_title_voice_id: str, + default_paragraph_voice_id: str, + default_model_id: str, + quality_preset: str, + title: str, + author: str, + isbn_number: str, + acx_volume_normalization: bool, + pronunciation_dictionary_locators: typing.List[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AddProjectResponseModel: + """ + Creates a new project, it can be either initialized as blank, from a document or from a URL. + + Parameters: + - name: str. The name of the project, used for identification only. + + - from_url: str. An optional URL from which we will extract content to initialize the project. If this is set, 'from_url' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the project as blank. + + - from_document: typing.Optional[core.File]. See core.File for more documentation + + - default_title_voice_id: str. The voice_id that corresponds to the default voice used for new titles. + + - default_paragraph_voice_id: str. The voice_id that corresponds to the default voice used for new paragraphs. + + - default_model_id: str. The model_id of the model to be used for this project, you can query GET https://api.elevenlabs.io/v1/models to list all available models. + + - quality_preset: str. Output quality of the generated audio. Must be one of: + standard - standard output format, 128kbps with 44.1kHz sample rate. + high - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. Using this setting increases the character cost by 20%. + ultra - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. Using this setting increases the character cost by 50%. + + - title: str. An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. + + - author: str. An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. + + - isbn_number: str. An optional ISBN number of the project you want to create, this will be added as metadata to the mp3 file on project / chapter download. + + - acx_volume_normalization: bool. When the project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + - pronunciation_dictionary_locators: typing.List[str]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects/add"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "from_url": from_url, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "quality_preset": quality_preset, + "title": title, + "author": author, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + } + ) + ) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "from_url": from_url, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "quality_preset": quality_preset, + "title": title, + "author": author, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + } + ) + ), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"from_document": from_document})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddProjectResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectExtendedResponseModel: + """ + Returns information about a specific project. This endpoint returns more detailed information about a project than GET api.elevenlabs.io/v1/projects. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.get( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ProjectExtendedResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a project by its project_id. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.delete( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def convert(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Starts conversion of a project and all of its chapters. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.convert( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/convert" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_snapshots( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotsResponseModel: + """ + Gets the snapshots of a project. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.get_snapshots( + project_id="project_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/snapshots" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ProjectSnapshotsResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def stream_audio( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Stream the audio from a project snapshot. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - project_snapshot_id: str. The project_snapshot_id of the project snapshot. You can query GET /v1/projects/{project_id}/snapshots to list all available snapshots for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + with self._client_wrapper.httpx_client.stream( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/stream", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) as _response: + if 200 <= _response.status_code < 300: + for _chunk in _response.iter_bytes(): + yield _chunk + return + _response.read() + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def update_pronunciation_dictionaries( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocatorDbModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Updates the set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocatorDbModel]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs import PronunciationDictionaryVersionLocatorDbModel + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.projects.update_pronunciation_dictionaries( + project_id="project_id", + pronunciation_dictionary_locators=[ + PronunciationDictionaryVersionLocatorDbModel( + pronunciation_dictionary_id="pronunciation_dictionary_id", + version_id="version_id", + ) + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/update-pronunciation-dictionaries", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncProjectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + self.chapters = AsyncChaptersClient(client_wrapper=self._client_wrapper) + + async def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetProjectsResponseModel: + """ + Returns a list of your projects together and its metadata. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.get_all() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetProjectsResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def add( + self, + *, + name: str, + from_url: str, + from_document: typing.Optional[core.File] = None, + default_title_voice_id: str, + default_paragraph_voice_id: str, + default_model_id: str, + quality_preset: str, + title: str, + author: str, + isbn_number: str, + acx_volume_normalization: bool, + pronunciation_dictionary_locators: typing.List[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AddProjectResponseModel: + """ + Creates a new project, it can be either initialized as blank, from a document or from a URL. + + Parameters: + - name: str. The name of the project, used for identification only. + + - from_url: str. An optional URL from which we will extract content to initialize the project. If this is set, 'from_url' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the project as blank. + + - from_document: typing.Optional[core.File]. See core.File for more documentation + + - default_title_voice_id: str. The voice_id that corresponds to the default voice used for new titles. + + - default_paragraph_voice_id: str. The voice_id that corresponds to the default voice used for new paragraphs. + + - default_model_id: str. The model_id of the model to be used for this project, you can query GET https://api.elevenlabs.io/v1/models to list all available models. + + - quality_preset: str. Output quality of the generated audio. Must be one of: + standard - standard output format, 128kbps with 44.1kHz sample rate. + high - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. Using this setting increases the character cost by 20%. + ultra - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. Using this setting increases the character cost by 50%. + + - title: str. An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. + + - author: str. An optional name of the author of the project, this will be added as metadata to the mp3 file on project / chapter download. + + - isbn_number: str. An optional ISBN number of the project you want to create, this will be added as metadata to the mp3 file on project / chapter download. + + - acx_volume_normalization: bool. When the project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + - pronunciation_dictionary_locators: typing.List[str]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects/add"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "from_url": from_url, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "quality_preset": quality_preset, + "title": title, + "author": author, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + } + ) + ) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder( + remove_none_from_dict( + { + "name": name, + "from_url": from_url, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "quality_preset": quality_preset, + "title": title, + "author": author, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + } + ) + ), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"from_document": from_document})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddProjectResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectExtendedResponseModel: + """ + Returns information about a specific project. This endpoint returns more detailed information about a project than GET api.elevenlabs.io/v1/projects. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.get( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ProjectExtendedResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a project by its project_id. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.delete( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def convert(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Starts conversion of a project and all of its chapters. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.convert( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/convert" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_snapshots( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotsResponseModel: + """ + Gets the snapshots of a project. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.get_snapshots( + project_id="project_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{jsonable_encoder(project_id)}/snapshots" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ProjectSnapshotsResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def stream_audio( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Stream the audio from a project snapshot. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - project_snapshot_id: str. The project_snapshot_id of the project snapshot. You can query GET /v1/projects/{project_id}/snapshots to list all available snapshots for a project. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + async with self._client_wrapper.httpx_client.stream( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/stream", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {}))) + if request_options is not None + else None, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) as _response: + if 200 <= _response.status_code < 300: + async for _chunk in _response.aiter_bytes(): + yield _chunk + return + await _response.aread() + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def update_pronunciation_dictionaries( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocatorDbModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Updates the set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters: + - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. + + - pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocatorDbModel]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs import PronunciationDictionaryVersionLocatorDbModel + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.projects.update_pronunciation_dictionaries( + project_id="project_id", + pronunciation_dictionary_locators=[ + PronunciationDictionaryVersionLocatorDbModel( + pronunciation_dictionary_id="pronunciation_dictionary_id", + version_id="version_id", + ) + ], + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/projects/{jsonable_encoder(project_id)}/update-pronunciation-dictionaries", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/pronunciation_dictionary/__init__.py b/src/elevenlabs/pronunciation_dictionary/__init__.py similarity index 100% rename from src/elevenlabs/resources/pronunciation_dictionary/__init__.py rename to src/elevenlabs/pronunciation_dictionary/__init__.py diff --git a/src/elevenlabs/pronunciation_dictionary/client.py b/src/elevenlabs/pronunciation_dictionary/client.py new file mode 100644 index 0000000..a982cae --- /dev/null +++ b/src/elevenlabs/pronunciation_dictionary/client.py @@ -0,0 +1,258 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel +from ..types.get_pronunciation_dictionary_metadata_response_model import GetPronunciationDictionaryMetadataResponseModel +from ..types.http_validation_error import HttpValidationError + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PronunciationDictionaryClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def add_from_file( + self, + *, + file: typing.Optional[core.File] = None, + name: str, + description: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters: + - file: typing.Optional[core.File]. See core.File for more documentation + + - name: str. The name of the pronunciation dictionary, used for identification only. + + - description: str. A description of the pronunciation dictionary, used for identification only. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", "v1/pronunciation-dictionaries/add-from-file" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"file": file})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddPronunciationDictionaryResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_metadata( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetPronunciationDictionaryMetadataResponseModel: + """ + Get metadata for a pronunciation dictionary + + Parameters: + - pronunciation_dictionary_id: str. The id of the pronunciation dictionary + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionary.get_metadata( + pronunciation_dictionary_id="pronunciation_dictionary_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetPronunciationDictionaryMetadataResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncPronunciationDictionaryClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def add_from_file( + self, + *, + file: typing.Optional[core.File] = None, + name: str, + description: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters: + - file: typing.Optional[core.File]. See core.File for more documentation + + - name: str. The name of the pronunciation dictionary, used for identification only. + + - description: str. A description of the pronunciation dictionary, used for identification only. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", "v1/pronunciation-dictionaries/add-from-file" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"file": file})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddPronunciationDictionaryResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_metadata( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetPronunciationDictionaryMetadataResponseModel: + """ + Get metadata for a pronunciation dictionary + + Parameters: + - pronunciation_dictionary_id: str. The id of the pronunciation dictionary + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.pronunciation_dictionary.get_metadata( + pronunciation_dictionary_id="pronunciation_dictionary_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetPronunciationDictionaryMetadataResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/__init__.py b/src/elevenlabs/resources/__init__.py deleted file mode 100644 index e76dc16..0000000 --- a/src/elevenlabs/resources/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from . import audio_native, history, models, projects, pronunciation_dictionary, samples, text_to_speech, user, voices - -__all__ = [ - "audio_native", - "history", - "models", - "projects", - "pronunciation_dictionary", - "samples", - "text_to_speech", - "user", - "voices", -] diff --git a/src/elevenlabs/resources/audio_native/client.py b/src/elevenlabs/resources/audio_native/client.py deleted file mode 100644 index 3e20a7c..0000000 --- a/src/elevenlabs/resources/audio_native/client.py +++ /dev/null @@ -1,174 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class AudioNativeClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def create( - self, - *, - name: str, - image: str, - author: str, - small: bool, - text_color: str, - background_color: str, - sessionization: int, - voice_id: str, - model_id: str, - file: typing.IO, - auto_convert: bool, - ) -> AudioNativeCreateProjectResponseModel: - """ - Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet. - - Parameters: - - name: str. - - - image: str. - - - author: str. - - - small: bool. - - - text_color: str. - - - background_color: str. - - - sessionization: int. - - - voice_id: str. - - - model_id: str. - - - file: typing.IO. - - - auto_convert: bool. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native"), - data=jsonable_encoder( - { - "name": name, - "image": image, - "author": author, - "small": small, - "text_color": text_color, - "background_color": background_color, - "sessionization": sessionization, - "voice_id": voice_id, - "model_id": model_id, - "auto_convert": auto_convert, - } - ), - files={"file": file}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AudioNativeCreateProjectResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncAudioNativeClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def create( - self, - *, - name: str, - image: str, - author: str, - small: bool, - text_color: str, - background_color: str, - sessionization: int, - voice_id: str, - model_id: str, - file: typing.IO, - auto_convert: bool, - ) -> AudioNativeCreateProjectResponseModel: - """ - Creates AudioNative enabled project, optionally starts conversion and returns project id and embeddable html snippet. - - Parameters: - - name: str. - - - image: str. - - - author: str. - - - small: bool. - - - text_color: str. - - - background_color: str. - - - sessionization: int. - - - voice_id: str. - - - model_id: str. - - - file: typing.IO. - - - auto_convert: bool. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/audio-native"), - data=jsonable_encoder( - { - "name": name, - "image": image, - "author": author, - "small": small, - "text_color": text_color, - "background_color": background_color, - "sessionization": sessionization, - "voice_id": voice_id, - "model_id": model_id, - "auto_convert": auto_convert, - } - ), - files={"file": file}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AudioNativeCreateProjectResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/history/client.py b/src/elevenlabs/resources/history/client.py deleted file mode 100644 index 679cd6a..0000000 --- a/src/elevenlabs/resources/history/client.py +++ /dev/null @@ -1,348 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.history import History -from ...types.history_item import HistoryItem -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class HistoryClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_all( - self, *, page_size: typing.Optional[int] = None, start_after_history_item_id: typing.Optional[str] = None - ) -> History: - """ - Returns metadata about all your generated audio. - - Parameters: - - page_size: typing.Optional[int]. How many history items to return at maximum. Can not exceed 1000, defaults to 100. - - - start_after_history_item_id: typing.Optional[str]. After which history_item_id to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.history.get_all() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history"), - params=remove_none_from_dict( - {"page_size": page_size, "start_after_history_item_id": start_after_history_item_id} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(History, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get(self, history_item_id: str) -> HistoryItem: - """ - Returns information about an history item by its ID. - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.history.get( - history_item_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(HistoryItem, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete(self, history_item_id: str) -> typing.Any: - """ - Delete a history item by its ID - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.history.delete( - history_item_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_audio(self, history_item_id: str) -> typing.Iterator[bytes]: - """ - Returns the audio of an history item. - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - """ - with self._client_wrapper.httpx_client.stream( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}/audio"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - for _chunk in _response.iter_bytes(): - yield _chunk - return - _response.read() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def download(self, *, history_item_ids: typing.List[str]) -> None: - """ - Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. - - Parameters: - - history_item_ids: typing.List[str]. A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.history.download( - history_item_ids=[], - ) - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"), - json=jsonable_encoder({"history_item_ids": history_item_ids}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncHistoryClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_all( - self, *, page_size: typing.Optional[int] = None, start_after_history_item_id: typing.Optional[str] = None - ) -> History: - """ - Returns metadata about all your generated audio. - - Parameters: - - page_size: typing.Optional[int]. How many history items to return at maximum. Can not exceed 1000, defaults to 100. - - - start_after_history_item_id: typing.Optional[str]. After which history_item_id to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.history.get_all() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history"), - params=remove_none_from_dict( - {"page_size": page_size, "start_after_history_item_id": start_after_history_item_id} - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(History, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get(self, history_item_id: str) -> HistoryItem: - """ - Returns information about an history item by its ID. - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.history.get( - history_item_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(HistoryItem, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete(self, history_item_id: str) -> typing.Any: - """ - Delete a history item by its ID - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.history.delete( - history_item_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_audio(self, history_item_id: str) -> typing.AsyncIterator[bytes]: - """ - Returns the audio of an history item. - - Parameters: - - history_item_id: str. History item ID to be used, you can use GET https://api.elevenlabs.io/v1/history to receive a list of history items and their IDs. - """ - async with self._client_wrapper.httpx_client.stream( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/history/{history_item_id}/audio"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - async for _chunk in _response.aiter_bytes(): - yield _chunk - return - await _response.aread() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def download(self, *, history_item_ids: typing.List[str]) -> None: - """ - Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. - - Parameters: - - history_item_ids: typing.List[str]. A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.history.download( - history_item_ids=[], - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/history/download"), - json=jsonable_encoder({"history_item_ids": history_item_ids}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/models/client.py b/src/elevenlabs/resources/models/client.py deleted file mode 100644 index fed0927..0000000 --- a/src/elevenlabs/resources/models/client.py +++ /dev/null @@ -1,82 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.model import Model - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class ModelsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_all(self) -> typing.List[Model]: - """ - Gets a list of available models. - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - xi_api_key="YOUR_XI_API_KEY", - ) - client.models.get_all() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/models"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Model], _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncModelsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_all(self) -> typing.List[Model]: - """ - Gets a list of available models. - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - xi_api_key="YOUR_XI_API_KEY", - ) - await client.models.get_all() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/models"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Model], _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/projects/__init__.py b/src/elevenlabs/resources/projects/__init__.py deleted file mode 100644 index 93f2184..0000000 --- a/src/elevenlabs/resources/projects/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .resources import chapters - -__all__ = ["chapters"] diff --git a/src/elevenlabs/resources/projects/client.py b/src/elevenlabs/resources/projects/client.py deleted file mode 100644 index f91ff30..0000000 --- a/src/elevenlabs/resources/projects/client.py +++ /dev/null @@ -1,645 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.add_project_response_model import AddProjectResponseModel -from ...types.get_projects_response_model import GetProjectsResponseModel -from ...types.http_validation_error import HttpValidationError -from ...types.project_extended_response_model import ProjectExtendedResponseModel -from ...types.project_snapshots_response_model import ProjectSnapshotsResponseModel -from ...types.pronunciation_dictionary_version_locator_db_model import PronunciationDictionaryVersionLocatorDbModel -from .resources.chapters.client import AsyncChaptersClient, ChaptersClient - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class ProjectsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - self.chapters = ChaptersClient(client_wrapper=self._client_wrapper) - - def get_all(self) -> GetProjectsResponseModel: - """ - Returns a list of your projects together and its metadata. - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.get_all() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetProjectsResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def add( - self, - *, - name: str, - from_url: str, - from_document: typing.IO, - default_title_voice_id: str, - default_paragraph_voice_id: str, - default_model_id: str, - quality_preset: str, - title: str, - author: str, - isbn_number: str, - acx_volume_normalization: bool, - pronunciation_dictionary_locators: typing.List[str], - ) -> AddProjectResponseModel: - """ - Creates a new project, it can be either initialized as blank, from a document or from a URL. - - Parameters: - - name: str. - - - from_url: str. - - - from_document: typing.IO. - - - default_title_voice_id: str. - - - default_paragraph_voice_id: str. - - - default_model_id: str. - - - quality_preset: str. - - - title: str. - - - author: str. - - - isbn_number: str. - - - acx_volume_normalization: bool. - - - pronunciation_dictionary_locators: typing.List[str]. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects/add"), - data=jsonable_encoder( - { - "name": name, - "from_url": from_url, - "default_title_voice_id": default_title_voice_id, - "default_paragraph_voice_id": default_paragraph_voice_id, - "default_model_id": default_model_id, - "quality_preset": quality_preset, - "title": title, - "author": author, - "isbn_number": isbn_number, - "acx_volume_normalization": acx_volume_normalization, - "pronunciation_dictionary_locators": pronunciation_dictionary_locators, - } - ), - files={"from_document": from_document}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddProjectResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get(self, project_id: str) -> ProjectExtendedResponseModel: - """ - Returns information about a specific project. This endpoint returns more detailed information about a project than GET api.elevenlabs.io/v1/projects. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.get( - project_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ProjectExtendedResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete(self, project_id: str) -> typing.Any: - """ - Delete a project by its project_id. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.delete( - project_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def convert(self, project_id: str) -> typing.Any: - """ - Starts conversion of a project and all of its chapters. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.convert( - project_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/convert"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_snapshots(self, project_id: str) -> ProjectSnapshotsResponseModel: - """ - Gets the snapshots of a project. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.get_snapshots( - project_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/snapshots"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ProjectSnapshotsResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def stream_audio(self, project_id: str, project_snapshot_id: str) -> typing.Iterator[bytes]: - """ - Stream the audio from a project snapshot. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - project_snapshot_id: str. The project_snapshot_id of the project snapshot. You can query GET /v1/projects/{project_id}/snapshots to list all available snapshots for a project. - """ - with self._client_wrapper.httpx_client.stream( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", - f"v1/projects/{project_id}/snapshots/{project_snapshot_id}/stream", - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - for _chunk in _response.iter_bytes(): - yield _chunk - return - _response.read() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def update_pronunciation_dictionaries( - self, - project_id: str, - *, - pronunciation_dictionary_locators: typing.List[PronunciationDictionaryVersionLocatorDbModel], - ) -> typing.Any: - """ - Updates the set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - pronunciation_dictionary_locators: typing.List[PronunciationDictionaryVersionLocatorDbModel]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.update_pronunciation_dictionaries( - project_id="string", - pronunciation_dictionary_locators=[], - ) - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/update-pronunciation-dictionaries" - ), - json=jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncProjectsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - self.chapters = AsyncChaptersClient(client_wrapper=self._client_wrapper) - - async def get_all(self) -> GetProjectsResponseModel: - """ - Returns a list of your projects together and its metadata. - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.get_all() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetProjectsResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add( - self, - *, - name: str, - from_url: str, - from_document: typing.IO, - default_title_voice_id: str, - default_paragraph_voice_id: str, - default_model_id: str, - quality_preset: str, - title: str, - author: str, - isbn_number: str, - acx_volume_normalization: bool, - pronunciation_dictionary_locators: typing.List[str], - ) -> AddProjectResponseModel: - """ - Creates a new project, it can be either initialized as blank, from a document or from a URL. - - Parameters: - - name: str. - - - from_url: str. - - - from_document: typing.IO. - - - default_title_voice_id: str. - - - default_paragraph_voice_id: str. - - - default_model_id: str. - - - quality_preset: str. - - - title: str. - - - author: str. - - - isbn_number: str. - - - acx_volume_normalization: bool. - - - pronunciation_dictionary_locators: typing.List[str]. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/projects/add"), - data=jsonable_encoder( - { - "name": name, - "from_url": from_url, - "default_title_voice_id": default_title_voice_id, - "default_paragraph_voice_id": default_paragraph_voice_id, - "default_model_id": default_model_id, - "quality_preset": quality_preset, - "title": title, - "author": author, - "isbn_number": isbn_number, - "acx_volume_normalization": acx_volume_normalization, - "pronunciation_dictionary_locators": pronunciation_dictionary_locators, - } - ), - files={"from_document": from_document}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddProjectResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get(self, project_id: str) -> ProjectExtendedResponseModel: - """ - Returns information about a specific project. This endpoint returns more detailed information about a project than GET api.elevenlabs.io/v1/projects. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.get( - project_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ProjectExtendedResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete(self, project_id: str) -> typing.Any: - """ - Delete a project by its project_id. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.delete( - project_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def convert(self, project_id: str) -> typing.Any: - """ - Starts conversion of a project and all of its chapters. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.convert( - project_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/convert"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_snapshots(self, project_id: str) -> ProjectSnapshotsResponseModel: - """ - Gets the snapshots of a project. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.get_snapshots( - project_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/snapshots"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ProjectSnapshotsResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def stream_audio(self, project_id: str, project_snapshot_id: str) -> typing.AsyncIterator[bytes]: - """ - Stream the audio from a project snapshot. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - project_snapshot_id: str. The project_snapshot_id of the project snapshot. You can query GET /v1/projects/{project_id}/snapshots to list all available snapshots for a project. - """ - async with self._client_wrapper.httpx_client.stream( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", - f"v1/projects/{project_id}/snapshots/{project_snapshot_id}/stream", - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - async for _chunk in _response.aiter_bytes(): - yield _chunk - return - await _response.aread() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def update_pronunciation_dictionaries( - self, - project_id: str, - *, - pronunciation_dictionary_locators: typing.List[PronunciationDictionaryVersionLocatorDbModel], - ) -> typing.Any: - """ - Updates the set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - pronunciation_dictionary_locators: typing.List[PronunciationDictionaryVersionLocatorDbModel]. A list of pronunciation dictionary locators (id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.update_pronunciation_dictionaries( - project_id="string", - pronunciation_dictionary_locators=[], - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/update-pronunciation-dictionaries" - ), - json=jsonable_encoder({"pronunciation_dictionary_locators": pronunciation_dictionary_locators}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/projects/resources/chapters/__init__.py b/src/elevenlabs/resources/projects/resources/chapters/__init__.py deleted file mode 100644 index 8c7b746..0000000 --- a/src/elevenlabs/resources/projects/resources/chapters/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .resources import snapshots - -__all__ = ["snapshots"] diff --git a/src/elevenlabs/resources/projects/resources/chapters/client.py b/src/elevenlabs/resources/projects/resources/chapters/client.py deleted file mode 100644 index 8e8aee5..0000000 --- a/src/elevenlabs/resources/projects/resources/chapters/client.py +++ /dev/null @@ -1,316 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from .....core.api_error import ApiError -from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .....errors.unprocessable_entity_error import UnprocessableEntityError -from .....types.chapter_response_model import ChapterResponseModel -from .....types.get_chapters_response_model import GetChaptersResponseModel -from .....types.http_validation_error import HttpValidationError -from .resources.snapshots.client import AsyncSnapshotsClient, SnapshotsClient - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class ChaptersClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - self.snapshots = SnapshotsClient(client_wrapper=self._client_wrapper) - - def get_all(self, project_id: str) -> GetChaptersResponseModel: - """ - Returns a list of your chapters for a project together and its metadata. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.chapters.get_all( - project_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetChaptersResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get(self, project_id: str, chapter_id: str) -> ChapterResponseModel: - """ - Returns information about a specific chapter. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.chapters.get( - project_id="string", - chapter_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ChapterResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete(self, project_id: str, chapter_id: str) -> typing.Any: - """ - Delete a chapter by its chapter_id. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.chapters.delete( - project_id="string", - chapter_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def convert(self, project_id: str, chapter_id: str) -> typing.Any: - """ - Starts conversion of a specific chapter. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.projects.chapters.convert( - project_id="string", - chapter_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}/convert" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncChaptersClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - self.snapshots = AsyncSnapshotsClient(client_wrapper=self._client_wrapper) - - async def get_all(self, project_id: str) -> GetChaptersResponseModel: - """ - Returns a list of your chapters for a project together and its metadata. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.chapters.get_all( - project_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetChaptersResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get(self, project_id: str, chapter_id: str) -> ChapterResponseModel: - """ - Returns information about a specific chapter. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.chapters.get( - project_id="string", - chapter_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ChapterResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete(self, project_id: str, chapter_id: str) -> typing.Any: - """ - Delete a chapter by its chapter_id. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.chapters.delete( - project_id="string", - chapter_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def convert(self, project_id: str, chapter_id: str) -> typing.Any: - """ - Starts conversion of a specific chapter. - - Parameters: - - project_id: str. The project_id of the project, you can query GET https://api.elevenlabs.io/v1/projects to list all available projects. - - - chapter_id: str. The chapter_id of the chapter. You can query GET https://api.elevenlabs.io/v1/projects/{project_id}/chapters to list all available chapters for a project. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.projects.chapters.convert( - project_id="string", - chapter_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/projects/{project_id}/chapters/{chapter_id}/convert" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/pronunciation_dictionary/client.py b/src/elevenlabs/resources/pronunciation_dictionary/client.py deleted file mode 100644 index d613bea..0000000 --- a/src/elevenlabs/resources/pronunciation_dictionary/client.py +++ /dev/null @@ -1,167 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel -from ...types.get_pronunciation_dictionary_metadata_response_model import ( - GetPronunciationDictionaryMetadataResponseModel, -) -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class PronunciationDictionaryClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def add_from_file(self, *, file: typing.IO, name: str, description: str) -> AddPronunciationDictionaryResponseModel: - """ - Creates a new pronunciation dictionary from a lexicon .PLS file - - Parameters: - - file: typing.IO. - - - name: str. - - - description: str. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/pronunciation-dictionaries/add-from-file" - ), - data=jsonable_encoder({"name": name, "description": description}), - files={"file": file}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddPronunciationDictionaryResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_metadata(self, pronunciation_dictionary_id: str) -> GetPronunciationDictionaryMetadataResponseModel: - """ - Get metadata for a pronunciation dictionary - - Parameters: - - pronunciation_dictionary_id: str. The id of the pronunciation dictionary - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.pronunciation_dictionary.get_metadata( - pronunciation_dictionary_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", - f"v1/pronunciation-dictionaries/{pronunciation_dictionary_id}", - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetPronunciationDictionaryMetadataResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncPronunciationDictionaryClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def add_from_file( - self, *, file: typing.IO, name: str, description: str - ) -> AddPronunciationDictionaryResponseModel: - """ - Creates a new pronunciation dictionary from a lexicon .PLS file - - Parameters: - - file: typing.IO. - - - name: str. - - - description: str. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", "v1/pronunciation-dictionaries/add-from-file" - ), - data=jsonable_encoder({"name": name, "description": description}), - files={"file": file}, - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddPronunciationDictionaryResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_metadata(self, pronunciation_dictionary_id: str) -> GetPronunciationDictionaryMetadataResponseModel: - """ - Get metadata for a pronunciation dictionary - - Parameters: - - pronunciation_dictionary_id: str. The id of the pronunciation dictionary - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.pronunciation_dictionary.get_metadata( - pronunciation_dictionary_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", - f"v1/pronunciation-dictionaries/{pronunciation_dictionary_id}", - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetPronunciationDictionaryMetadataResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/samples/client.py b/src/elevenlabs/resources/samples/client.py deleted file mode 100644 index 687cf57..0000000 --- a/src/elevenlabs/resources/samples/client.py +++ /dev/null @@ -1,173 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class SamplesClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def delete(self, voice_id: str, sample_id: str) -> typing.Any: - """ - Removes a sample by its ID. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.samples.delete( - voice_id="string", - sample_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/samples/{sample_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_audio(self, voice_id: str, sample_id: str) -> None: - """ - Returns the audio corresponding to a sample attached to a voice. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.samples.get_audio( - voice_id="string", - sample_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/samples/{sample_id}/audio" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncSamplesClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def delete(self, voice_id: str, sample_id: str) -> typing.Any: - """ - Removes a sample by its ID. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.samples.delete( - voice_id="string", - sample_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/samples/{sample_id}" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_audio(self, voice_id: str, sample_id: str) -> None: - """ - Returns the audio corresponding to a sample attached to a voice. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.samples.get_audio( - voice_id="string", - sample_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( - f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/samples/{sample_id}/audio" - ), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/user/client.py b/src/elevenlabs/resources/user/client.py deleted file mode 100644 index e4ebe00..0000000 --- a/src/elevenlabs/resources/user/client.py +++ /dev/null @@ -1,138 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.http_validation_error import HttpValidationError -from ...types.subscription import Subscription -from ...types.user import User - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class UserClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_subscription(self) -> Subscription: - """ - Gets extended information about the users subscription - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.user.get_subscription() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user/subscription"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Subscription, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get(self) -> User: - """ - Gets information about the user - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.user.get() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(User, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncUserClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_subscription(self) -> Subscription: - """ - Gets extended information about the users subscription - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.user.get_subscription() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user/subscription"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(Subscription, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get(self) -> User: - """ - Gets information about the user - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.user.get() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(User, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/voices/client.py b/src/elevenlabs/resources/voices/client.py deleted file mode 100644 index ea5f111..0000000 --- a/src/elevenlabs/resources/voices/client.py +++ /dev/null @@ -1,685 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import httpx -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -from ...core.api_error import ApiError -from ...core.file import FileType -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...errors.unprocessable_entity_error import UnprocessableEntityError -from ...types.add_voice_response_model import AddVoiceResponseModel -from ...types.get_voices_response_model import GetVoicesResponseModel -from ...types.http_validation_error import HttpValidationError -from ...types.voice_response import VoiceResponse -from ...types.voice_settings import VoiceSettings -from ...types.age import Age -from ...types.gender import Gender -from ...types.accent import Accent - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class VoicesClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_all(self) -> GetVoicesResponseModel: - """ - Gets a list of all available voices for a user. - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.get_all() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetVoicesResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_default_settings(self) -> VoiceSettings: - """ - Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.get_default_settings() - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/settings/default"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get_settings(self, voice_id: str) -> VoiceSettings: - """ - Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.get_settings( - voice_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/settings"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def get(self, voice_id: str, *, with_settings: typing.Optional[bool] = None) -> VoiceResponse: - """ - Returns metadata about a specific voice. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - with_settings: typing.Optional[bool]. If set will return settings information corresponding to the voice, requires authorization. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.get( - voice_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}"), - params=remove_none_from_dict({"with_settings": with_settings}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponse, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def delete(self, voice_id: str) -> typing.Any: - """ - Deletes a voice by its ID. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - --- - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.delete( - voice_id="string", - ) - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def edit_settings(self, voice_id: str, *, request: VoiceSettings) -> typing.Any: - """ - Edit your settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - request: VoiceSettings. - --- - from elevenlabs import VoiceSettings - from elevenlabs.client import ElevenLabs - - client = ElevenLabs( - api_key="YOUR_API_KEY", - ) - client.voices.edit_settings( - voice_id="string", - request=VoiceSettings( - stability=1.1, - similarity_boost=1.1, - ), - ) - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/settings/edit"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def add(self, *, name: str, files: typing.List[FileType], description: str, labels: str) -> AddVoiceResponseModel: - """ - Add a new voice to your collection of voices in VoiceLab. - - Parameters: - - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. - - - files: typing.List[str]. One or more audio files to clone the voice from - - - description: str. How would you describe the voice? - - - labels: str. Serialized labels dictionary for the voice. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/add"), - data=jsonable_encoder( - { - "name": name, - "description": description, - "labels": labels, - } - ), - files=[("files", file) for file in files], - headers=self._client_wrapper.get_headers(), - timeout=None, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddVoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def edit(self, voice_id: str, *, name: str, files: typing.List[str], description: str, labels: str) -> typing.Any: - """ - Edit a voice created by you. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. - - - files: typing.List[str]. Audio files to add to the voice - - - description: str. How would you describe the voice? - - - labels: str. Serialized labels dictionary for the voice. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/edit"), - json=jsonable_encoder({"name": name, "files": files, "description": description, "labels": labels}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def design( - self, - *, - name: typing.Optional[str] = OMIT, - text: typing.Optional[str] = OMIT, - voice_description: typing.Optional[str] = OMIT, - gender: typing.Optional[Gender] = OMIT, - age: typing.Optional[Age] = OMIT, - accent: typing.Optional[Accent] = OMIT, - accent_strength: typing.Optional[float] = OMIT, - ) -> bytes: - """ - Parameters: - - name: typing.Optional[str]. - - - text: typing.Optional[str]. - - - voice_description: typing.Optional[str]. - - - gender: typing.Optional[Gender]. - - - age: typing.Optional[Age]. - - - accent: typing.Optional[Accent]. - - - accent_strength: typing.Optional[float]. - """ - _request: typing.Dict[str, typing.Any] = {} - if name is not OMIT: - _request["name"] = name - if text is not OMIT: - _request["text"] = text - if voice_description is not OMIT: - _request["voice_description"] = voice_description - if gender is not OMIT: - _request["gender"] = gender - if age is not OMIT: - _request["age"] = age - if accent is not OMIT: - _request["accent"] = accent - if accent_strength is not OMIT: - _request["accent_strength"] = accent_strength - with self._client_wrapper.httpx_client.stream( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voice-generation/generate-voice"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - return _response.read() - _response.read() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - -class AsyncVoicesClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_all(self) -> GetVoicesResponseModel: - """ - Gets a list of all available voices for a user. - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.get_all() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(GetVoicesResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_default_settings(self) -> VoiceSettings: - """ - Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.get_default_settings() - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/settings/default"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get_settings(self, voice_id: str) -> VoiceSettings: - """ - Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.get_settings( - voice_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/settings"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def get(self, voice_id: str, *, with_settings: typing.Optional[bool] = None) -> VoiceResponse: - """ - Returns metadata about a specific voice. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - with_settings: typing.Optional[bool]. If set will return settings information corresponding to the voice, requires authorization. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.get( - voice_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}"), - params=remove_none_from_dict({"with_settings": with_settings}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(VoiceResponse, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def delete(self, voice_id: str) -> typing.Any: - """ - Deletes a voice by its ID. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - --- - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.delete( - voice_id="string", - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def edit_settings(self, voice_id: str, *, request: VoiceSettings) -> typing.Any: - """ - Edit your settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - request: VoiceSettings. - --- - from elevenlabs import VoiceSettings - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - api_key="YOUR_API_KEY", - ) - await client.voices.edit_settings( - voice_id="string", - request=VoiceSettings( - stability=1.1, - similarity_boost=1.1, - ), - ) - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/settings/edit"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def add(self, *, name: str, files: typing.List[str], description: str, labels: str) -> AddVoiceResponseModel: - """ - Add a new voice to your collection of voices in VoiceLab. - - Parameters: - - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. - - - files: typing.List[str]. One or more audio files to clone the voice from - - - description: str. How would you describe the voice? - - - labels: str. Serialized labels dictionary for the voice. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/add"), - json=jsonable_encoder({"name": name, "files": files, "description": description, "labels": labels}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(AddVoiceResponseModel, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def edit( - self, voice_id: str, *, name: str, files: typing.List[str], description: str, labels: str - ) -> typing.Any: - """ - Edit a voice created by you. - - Parameters: - - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. - - - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. - - - files: typing.List[str]. Audio files to add to the voice - - - description: str. How would you describe the voice? - - - labels: str. Serialized labels dictionary for the voice. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{voice_id}/edit"), - json=jsonable_encoder({"name": name, "files": files, "description": description, "labels": labels}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore - if _response.status_code == 422: - raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def design( - self, - *, - name: typing.Optional[str] = OMIT, - text: typing.Optional[str] = OMIT, - voice_description: typing.Optional[str] = OMIT, - gender: typing.Optional[Gender] = OMIT, - age: typing.Optional[Age] = OMIT, - accent: typing.Optional[Accent] = OMIT, - accent_strength: typing.Optional[float] = OMIT, - ) -> bytes: - """ - Parameters: - - name: typing.Optional[str]. - - - text: typing.Optional[str]. - - - voice_description: typing.Optional[str]. - - - gender: typing.Optional[Gender]. - - - age: typing.Optional[Age]. - - - accent: typing.Optional[Accent]. - - - accent_strength: typing.Optional[float]. - --- - from elevenlabs import Accent, Age, Gender - from elevenlabs.client import AsyncElevenLabs - - client = AsyncElevenLabs( - xi_api_key="YOUR_XI_API_KEY", - ) - await client.voices.generate( - gender=Gender.MALE, - age=Age.YOUNG, - accent=Accent.BRITISH, - ) - """ - _request: typing.Dict[str, typing.Any] = {} - if name is not OMIT: - _request["name"] = name - if text is not OMIT: - _request["text"] = text - if voice_description is not OMIT: - _request["voice_description"] = voice_description - if gender is not OMIT: - _request["gender"] = gender - if age is not OMIT: - _request["age"] = age - if accent is not OMIT: - _request["accent"] = accent - if accent_strength is not OMIT: - _request["accent_strength"] = accent_strength - async with self._client_wrapper.httpx_client.stream( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voice-generation/generate-voice"), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) as _response: - if 200 <= _response.status_code < 300: - return await _response.aread() - await _response.aread() - try: - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/samples/__init__.py b/src/elevenlabs/samples/__init__.py similarity index 100% rename from src/elevenlabs/resources/samples/__init__.py rename to src/elevenlabs/samples/__init__.py diff --git a/src/elevenlabs/samples/client.py b/src/elevenlabs/samples/client.py new file mode 100644 index 0000000..91a4535 --- /dev/null +++ b/src/elevenlabs/samples/client.py @@ -0,0 +1,252 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.http_validation_error import HttpValidationError + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class SamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Removes a sample by its ID. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.samples.delete( + voice_id="voice_id", + sample_id="sample_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_audio( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.samples.get_audio( + voice_id="voice_id", + sample_id="sample_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Removes a sample by its ID. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.samples.delete( + voice_id="voice_id", + sample_id="sample_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_audio( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - sample_id: str. Sample ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id} to list all the available samples for a voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.samples.get_audio( + voice_id="voice_id", + sample_id="sample_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/resources/text_to_speech/__init__.py b/src/elevenlabs/text_to_speech/__init__.py similarity index 100% rename from src/elevenlabs/resources/text_to_speech/__init__.py rename to src/elevenlabs/text_to_speech/__init__.py diff --git a/src/elevenlabs/resources/text_to_speech/client.py b/src/elevenlabs/text_to_speech/client.py similarity index 71% rename from src/elevenlabs/resources/text_to_speech/client.py rename to src/elevenlabs/text_to_speech/client.py index f9390a4..88f14d3 100644 --- a/src/elevenlabs/resources/text_to_speech/client.py +++ b/src/elevenlabs/text_to_speech/client.py @@ -4,11 +4,12 @@ import urllib.parse from json.decoder import JSONDecodeError -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.jsonable_encoder import jsonable_encoder -from ...core.remove_none_from_dict import remove_none_from_dict -from ...types.voice_settings import VoiceSettings +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..types.voice_settings import VoiceSettings # this is used as the default value for optional parameters OMIT = typing.cast(typing.Any, ...) @@ -27,6 +28,7 @@ def convert( text: str, model_id: typing.Optional[str] = OMIT, voice_settings: typing.Optional[VoiceSettings] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[bytes]: """ Converts text into speech using a voice of your choice and returns audio. @@ -59,6 +61,8 @@ def convert( - model_id: typing.Optional[str]. Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. - voice_settings: typing.Optional[VoiceSettings]. Voice settings overriding stored setttings for the given voice. They are applied only on the given request. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ _request: typing.Dict[str, typing.Any] = {"text": text} if model_id is not OMIT: @@ -67,13 +71,41 @@ def convert( _request["voice_settings"] = voice_settings with self._client_wrapper.httpx_client.stream( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{voice_id}"), - params=remove_none_from_dict( - {"optimize_streaming_latency": optimize_streaming_latency, "output_format": output_format} + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{jsonable_encoder(voice_id)}" + ), + params=jsonable_encoder( + remove_none_from_dict( + { + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + json=jsonable_encoder(_request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(_request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: for _chunk in _response.iter_bytes(): @@ -95,6 +127,7 @@ def convert_as_stream( text: str, model_id: typing.Optional[str] = OMIT, voice_settings: typing.Optional[VoiceSettings] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> typing.Iterator[bytes]: """ Converts text into speech using a voice of your choice and returns audio as an audio stream. @@ -127,6 +160,8 @@ def convert_as_stream( - model_id: typing.Optional[str]. Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. - voice_settings: typing.Optional[VoiceSettings]. Voice settings overriding stored setttings for the given voice. They are applied only on the given request. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ _request: typing.Dict[str, typing.Any] = {"text": text} if model_id is not OMIT: @@ -135,13 +170,41 @@ def convert_as_stream( _request["voice_settings"] = voice_settings with self._client_wrapper.httpx_client.stream( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{voice_id}/stream"), - params=remove_none_from_dict( - {"optimize_streaming_latency": optimize_streaming_latency, "output_format": output_format} + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream" + ), + params=jsonable_encoder( + remove_none_from_dict( + { + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + json=jsonable_encoder(_request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(_request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: for _chunk in _response.iter_bytes(): @@ -168,6 +231,7 @@ async def convert( text: str, model_id: typing.Optional[str] = OMIT, voice_settings: typing.Optional[VoiceSettings] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[bytes]: """ Converts text into speech using a voice of your choice and returns audio. @@ -200,6 +264,8 @@ async def convert( - model_id: typing.Optional[str]. Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. - voice_settings: typing.Optional[VoiceSettings]. Voice settings overriding stored setttings for the given voice. They are applied only on the given request. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ _request: typing.Dict[str, typing.Any] = {"text": text} if model_id is not OMIT: @@ -208,13 +274,41 @@ async def convert( _request["voice_settings"] = voice_settings async with self._client_wrapper.httpx_client.stream( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{voice_id}"), - params=remove_none_from_dict( - {"optimize_streaming_latency": optimize_streaming_latency, "output_format": output_format} + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{jsonable_encoder(voice_id)}" + ), + params=jsonable_encoder( + remove_none_from_dict( + { + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + json=jsonable_encoder(_request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(_request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: async for _chunk in _response.aiter_bytes(): @@ -236,6 +330,7 @@ async def convert_as_stream( text: str, model_id: typing.Optional[str] = OMIT, voice_settings: typing.Optional[VoiceSettings] = OMIT, + request_options: typing.Optional[RequestOptions] = None, ) -> typing.AsyncIterator[bytes]: """ Converts text into speech using a voice of your choice and returns audio as an audio stream. @@ -268,6 +363,8 @@ async def convert_as_stream( - model_id: typing.Optional[str]. Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. - voice_settings: typing.Optional[VoiceSettings]. Voice settings overriding stored setttings for the given voice. They are applied only on the given request. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. """ _request: typing.Dict[str, typing.Any] = {"text": text} if model_id is not OMIT: @@ -276,13 +373,41 @@ async def convert_as_stream( _request["voice_settings"] = voice_settings async with self._client_wrapper.httpx_client.stream( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{voice_id}/stream"), - params=remove_none_from_dict( - {"optimize_streaming_latency": optimize_streaming_latency, "output_format": output_format} + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream" + ), + params=jsonable_encoder( + remove_none_from_dict( + { + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + json=jsonable_encoder(_request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(_request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) ), - json=jsonable_encoder(_request), - headers=self._client_wrapper.get_headers(), - timeout=60, + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore ) as _response: if 200 <= _response.status_code < 300: async for _chunk in _response.aiter_bytes(): diff --git a/src/elevenlabs/types/__init__.py b/src/elevenlabs/types/__init__.py index 1f7c07f..9ccc921 100644 --- a/src/elevenlabs/types/__init__.py +++ b/src/elevenlabs/types/__init__.py @@ -1,37 +1,32 @@ # This file was auto-generated by Fern from our API Definition. -from .accent import Accent from .add_project_response_model import AddProjectResponseModel from .add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel from .add_voice_response_model import AddVoiceResponseModel -from .age import Age from .audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel from .audio_native_get_embed_code_response_model import AudioNativeGetEmbedCodeResponseModel from .chapter_response_model import ChapterResponseModel -from .chapter_response_model_state import ChapterResponseModelState from .chapter_snapshot_response_model import ChapterSnapshotResponseModel from .chapter_snapshots_response_model import ChapterSnapshotsResponseModel from .chapter_statistics_response_model import ChapterStatisticsResponseModel from .currency import Currency -from .extended_subscription_response_model_currency import ExtendedSubscriptionResponseModelCurrency +from .extended_subscription_response_model import ExtendedSubscriptionResponseModel from .feedback_item import FeedbackItem from .fine_tuning_response_model import FineTuningResponseModel -from .finetunig_state import FinetunigState -from .gender import Gender +from .finetuning_state import FinetuningState from .get_chapters_response_model import GetChaptersResponseModel +from .get_history_response_model import GetHistoryResponseModel from .get_projects_response_model import GetProjectsResponseModel from .get_pronunciation_dictionary_metadata_response_model import GetPronunciationDictionaryMetadataResponseModel from .get_voices_response_model import GetVoicesResponseModel -from .history import History from .history_item import HistoryItem -from .history_item_state import HistoryItemState from .http_validation_error import HttpValidationError from .invoice_response_model import InvoiceResponseModel -from .invoice_response_model_currency import InvoiceResponseModelCurrency +from .item_state import ItemState from .language_response_model import LanguageResponseModel from .manual_verification_file_response_model import ManualVerificationFileResponseModel from .manual_verification_response_model import ManualVerificationResponseModel -from .model import Model +from .model_response import ModelResponse from .project_extended_response_model import ProjectExtendedResponseModel from .project_response_model import ProjectResponseModel from .project_snapshot_response_model import ProjectSnapshotResponseModel @@ -40,53 +35,48 @@ from .pronunciation_dictionary_version_locator_db_model import PronunciationDictionaryVersionLocatorDbModel from .recording_response_model import RecordingResponseModel from .review_status import ReviewStatus -from .subscription import Subscription +from .sample_response_model import SampleResponseModel +from .state import State from .subscription_response import SubscriptionResponse from .subscription_status import SubscriptionStatus -from .user import User +from .user_response import UserResponse from .validation_error import ValidationError from .validation_error_loc_item import ValidationErrorLocItem from .verification_attempt_response_model import VerificationAttemptResponseModel from .voice_category import VoiceCategory from .voice_response import VoiceResponse -from .voice_sample import VoiceSample from .voice_settings import VoiceSettings from .voice_sharing_response_model import VoiceSharingResponseModel from .voice_sharing_state import VoiceSharingState __all__ = [ - "Accent", "AddProjectResponseModel", "AddPronunciationDictionaryResponseModel", "AddVoiceResponseModel", - "Age", "AudioNativeCreateProjectResponseModel", "AudioNativeGetEmbedCodeResponseModel", "ChapterResponseModel", - "ChapterResponseModelState", "ChapterSnapshotResponseModel", "ChapterSnapshotsResponseModel", "ChapterStatisticsResponseModel", "Currency", - "ExtendedSubscriptionResponseModelCurrency", + "ExtendedSubscriptionResponseModel", "FeedbackItem", "FineTuningResponseModel", - "FinetunigState", - "Gender", + "FinetuningState", "GetChaptersResponseModel", + "GetHistoryResponseModel", "GetProjectsResponseModel", "GetPronunciationDictionaryMetadataResponseModel", "GetVoicesResponseModel", - "History", "HistoryItem", - "HistoryItemState", "HttpValidationError", "InvoiceResponseModel", - "InvoiceResponseModelCurrency", + "ItemState", "LanguageResponseModel", "ManualVerificationFileResponseModel", "ManualVerificationResponseModel", - "Model", + "ModelResponse", "ProjectExtendedResponseModel", "ProjectResponseModel", "ProjectSnapshotResponseModel", @@ -95,16 +85,16 @@ "PronunciationDictionaryVersionLocatorDbModel", "RecordingResponseModel", "ReviewStatus", - "Subscription", + "SampleResponseModel", + "State", "SubscriptionResponse", "SubscriptionStatus", - "User", + "UserResponse", "ValidationError", "ValidationErrorLocItem", "VerificationAttemptResponseModel", "VoiceCategory", "VoiceResponse", - "VoiceSample", "VoiceSettings", "VoiceSharingResponseModel", "VoiceSharingState", diff --git a/src/elevenlabs/types/accent.py b/src/elevenlabs/types/accent.py deleted file mode 100644 index d8c121c..0000000 --- a/src/elevenlabs/types/accent.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class Accent(str, enum.Enum): - BRITISH = "british" - AMERICAN = "american" - AFRICAN = "african" - AUSTRALIAN = "australian" - INDIAN = "indian" - - def visit( - self, - british: typing.Callable[[], T_Result], - american: typing.Callable[[], T_Result], - african: typing.Callable[[], T_Result], - australian: typing.Callable[[], T_Result], - indian: typing.Callable[[], T_Result], - ) -> T_Result: - if self is Accent.BRITISH: - return british() - if self is Accent.AMERICAN: - return american() - if self is Accent.AFRICAN: - return african() - if self is Accent.AUSTRALIAN: - return australian() - if self is Accent.INDIAN: - return indian() diff --git a/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py b/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py index e15125b..d8caa47 100644 --- a/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py +++ b/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py @@ -17,7 +17,7 @@ class AddPronunciationDictionaryResponseModel(pydantic.BaseModel): created_by: str creation_time_unix: int version_id: str - description: typing.Optional[str] + description: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/age.py b/src/elevenlabs/types/age.py deleted file mode 100644 index ae4cbea..0000000 --- a/src/elevenlabs/types/age.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class Age(str, enum.Enum): - YOUNG = "young" - MIDDLE_AGED = "middle_aged" - OLD = "old" - - def visit( - self, - young: typing.Callable[[], T_Result], - middle_aged: typing.Callable[[], T_Result], - old: typing.Callable[[], T_Result], - ) -> T_Result: - if self is Age.YOUNG: - return young() - if self is Age.MIDDLE_AGED: - return middle_aged() - if self is Age.OLD: - return old() diff --git a/src/elevenlabs/types/chapter_response_model.py b/src/elevenlabs/types/chapter_response_model.py index b9f1f6a..ede227d 100644 --- a/src/elevenlabs/types/chapter_response_model.py +++ b/src/elevenlabs/types/chapter_response_model.py @@ -4,8 +4,8 @@ import typing from ..core.datetime_utils import serialize_datetime -from .chapter_response_model_state import ChapterResponseModelState from .chapter_statistics_response_model import ChapterStatisticsResponseModel +from .state import State try: import pydantic.v1 as pydantic # type: ignore @@ -17,10 +17,10 @@ class ChapterResponseModel(pydantic.BaseModel): chapter_id: str name: str can_be_downloaded: bool - state: ChapterResponseModelState - last_conversion_date_unix: typing.Optional[int] - conversion_progress: typing.Optional[float] - statistics: typing.Optional[ChapterStatisticsResponseModel] + state: State + last_conversion_date_unix: typing.Optional[int] = None + conversion_progress: typing.Optional[float] = None + statistics: typing.Optional[ChapterStatisticsResponseModel] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/subscription.py b/src/elevenlabs/types/extended_subscription_response_model.py similarity index 73% rename from src/elevenlabs/types/subscription.py rename to src/elevenlabs/types/extended_subscription_response_model.py index 04df10f..5149ad8 100644 --- a/src/elevenlabs/types/subscription.py +++ b/src/elevenlabs/types/extended_subscription_response_model.py @@ -4,7 +4,7 @@ import typing from ..core.datetime_utils import serialize_datetime -from .extended_subscription_response_model_currency import ExtendedSubscriptionResponseModelCurrency +from .currency import Currency from .invoice_response_model import InvoiceResponseModel from .subscription_status import SubscriptionStatus @@ -14,7 +14,7 @@ import pydantic # type: ignore -class Subscription(pydantic.BaseModel): +class ExtendedSubscriptionResponseModel(pydantic.BaseModel): tier: str character_count: int character_limit: int @@ -22,16 +22,16 @@ class Subscription(pydantic.BaseModel): allowed_to_extend_character_limit: bool next_character_count_reset_unix: int voice_limit: int - max_voice_add_edits: typing.Optional[int] - voice_add_edit_counter: typing.Optional[int] + max_voice_add_edits: int + voice_add_edit_counter: int professional_voice_limit: int can_extend_voice_limit: bool can_use_instant_voice_cloning: bool can_use_professional_voice_cloning: bool - status: typing.Optional[SubscriptionStatus] - has_open_invoices: typing.Optional[bool] - currency: typing.Optional[ExtendedSubscriptionResponseModelCurrency] - next_invoice: typing.Optional[InvoiceResponseModel] + status: SubscriptionStatus + has_open_invoices: bool + currency: typing.Optional[Currency] = None + next_invoice: typing.Optional[InvoiceResponseModel] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/extended_subscription_response_model_currency.py b/src/elevenlabs/types/extended_subscription_response_model_currency.py deleted file mode 100644 index 1c58779..0000000 --- a/src/elevenlabs/types/extended_subscription_response_model_currency.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class ExtendedSubscriptionResponseModelCurrency(str, enum.Enum): - USD = "usd" - EUR = "eur" - - def visit(self, usd: typing.Callable[[], T_Result], eur: typing.Callable[[], T_Result]) -> T_Result: - if self is ExtendedSubscriptionResponseModelCurrency.USD: - return usd() - if self is ExtendedSubscriptionResponseModelCurrency.EUR: - return eur() diff --git a/src/elevenlabs/types/feedback_item.py b/src/elevenlabs/types/feedback_item.py index 4e5258a..669dcd3 100644 --- a/src/elevenlabs/types/feedback_item.py +++ b/src/elevenlabs/types/feedback_item.py @@ -19,7 +19,7 @@ class FeedbackItem(pydantic.BaseModel): glitches: bool audio_quality: bool other: bool - review_status: typing.Optional[str] + review_status: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/fine_tuning_response_model.py b/src/elevenlabs/types/fine_tuning_response_model.py index bbc2f0a..2cf9670 100644 --- a/src/elevenlabs/types/fine_tuning_response_model.py +++ b/src/elevenlabs/types/fine_tuning_response_model.py @@ -4,7 +4,7 @@ import typing from ..core.datetime_utils import serialize_datetime -from .finetunig_state import FinetunigState +from .finetuning_state import FinetuningState from .manual_verification_response_model import ManualVerificationResponseModel from .verification_attempt_response_model import VerificationAttemptResponseModel @@ -15,16 +15,16 @@ class FineTuningResponseModel(pydantic.BaseModel): - is_allowed_to_fine_tune: typing.Optional[bool] - fine_tuning_requested: typing.Optional[bool] - finetuning_state: typing.Optional[FinetunigState] - verification_failures: typing.Optional[typing.List[str]] - verification_attempts_count: typing.Optional[int] - manual_verification_requested: typing.Optional[bool] - verification_attempts: typing.Optional[typing.List[VerificationAttemptResponseModel]] - slice_ids: typing.Optional[typing.List[str]] - manual_verification: typing.Optional[ManualVerificationResponseModel] - language: typing.Optional[str] + is_allowed_to_fine_tune: bool + fine_tuning_requested: bool + finetuning_state: FinetuningState + verification_failures: typing.List[str] + verification_attempts_count: int + manual_verification_requested: bool + verification_attempts: typing.Optional[typing.List[VerificationAttemptResponseModel]] = None + slice_ids: typing.Optional[typing.List[str]] = None + manual_verification: typing.Optional[ManualVerificationResponseModel] = None + language: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/finetunig_state.py b/src/elevenlabs/types/finetuning_state.py similarity index 74% rename from src/elevenlabs/types/finetunig_state.py rename to src/elevenlabs/types/finetuning_state.py index 67ab356..f893889 100644 --- a/src/elevenlabs/types/finetunig_state.py +++ b/src/elevenlabs/types/finetuning_state.py @@ -6,7 +6,7 @@ T_Result = typing.TypeVar("T_Result") -class FinetunigState(str, enum.Enum): +class FinetuningState(str, enum.Enum): NOT_STARTED = "not_started" IS_FINE_TUNING = "is_fine_tuning" FINE_TUNED = "fine_tuned" @@ -17,9 +17,9 @@ def visit( is_fine_tuning: typing.Callable[[], T_Result], fine_tuned: typing.Callable[[], T_Result], ) -> T_Result: - if self is FinetunigState.NOT_STARTED: + if self is FinetuningState.NOT_STARTED: return not_started() - if self is FinetunigState.IS_FINE_TUNING: + if self is FinetuningState.IS_FINE_TUNING: return is_fine_tuning() - if self is FinetunigState.FINE_TUNED: + if self is FinetuningState.FINE_TUNED: return fine_tuned() diff --git a/src/elevenlabs/types/gender.py b/src/elevenlabs/types/gender.py deleted file mode 100644 index 7ace2b9..0000000 --- a/src/elevenlabs/types/gender.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class Gender(str, enum.Enum): - MALE = "male" - FEMALE = "female" - - def visit(self, male: typing.Callable[[], T_Result], female: typing.Callable[[], T_Result]) -> T_Result: - if self is Gender.MALE: - return male() - if self is Gender.FEMALE: - return female() diff --git a/src/elevenlabs/types/history.py b/src/elevenlabs/types/get_history_response_model.py similarity index 89% rename from src/elevenlabs/types/history.py rename to src/elevenlabs/types/get_history_response_model.py index 3fa6b60..a073268 100644 --- a/src/elevenlabs/types/history.py +++ b/src/elevenlabs/types/get_history_response_model.py @@ -12,10 +12,10 @@ import pydantic # type: ignore -class History(pydantic.BaseModel): +class GetHistoryResponseModel(pydantic.BaseModel): history: typing.List[HistoryItem] has_more: bool - last_history_item_id: typing.Optional[str] + last_history_item_id: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_model.py b/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_model.py index d9b0df1..25ae3dd 100644 --- a/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_model.py +++ b/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_model.py @@ -16,7 +16,7 @@ class GetPronunciationDictionaryMetadataResponseModel(pydantic.BaseModel): name: str created_by: str creation_time_unix: int - description: typing.Optional[str] + description: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/history_item.py b/src/elevenlabs/types/history_item.py index a6be162..fddca0a 100644 --- a/src/elevenlabs/types/history_item.py +++ b/src/elevenlabs/types/history_item.py @@ -5,7 +5,7 @@ from ..core.datetime_utils import serialize_datetime from .feedback_item import FeedbackItem -from .history_item_state import HistoryItemState +from .item_state import ItemState from .voice_category import VoiceCategory try: @@ -17,18 +17,18 @@ class HistoryItem(pydantic.BaseModel): history_item_id: str voice_id: str - voice_name: typing.Optional[str] + voice_name: str text: str date_unix: int character_count_change_from: int character_count_change_to: int content_type: str - state: typing.Optional[HistoryItemState] - request_id: typing.Optional[str] - model_id: typing.Optional[str] - voice_category: typing.Optional[VoiceCategory] - settings: typing.Optional[typing.Dict[str, typing.Any]] - feedback: typing.Optional[FeedbackItem] + state: ItemState + request_id: typing.Optional[str] = None + model_id: typing.Optional[str] = None + voice_category: typing.Optional[VoiceCategory] = None + settings: typing.Optional[typing.Dict[str, typing.Any]] = None + feedback: typing.Optional[FeedbackItem] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/http_validation_error.py b/src/elevenlabs/types/http_validation_error.py index e5f647b..267b46a 100644 --- a/src/elevenlabs/types/http_validation_error.py +++ b/src/elevenlabs/types/http_validation_error.py @@ -13,7 +13,7 @@ class HttpValidationError(pydantic.BaseModel): - detail: typing.Optional[typing.List[ValidationError]] + detail: typing.Optional[typing.List[ValidationError]] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/invoice_response_model.py b/src/elevenlabs/types/invoice_response_model.py index 9b04047..ef9871c 100644 --- a/src/elevenlabs/types/invoice_response_model.py +++ b/src/elevenlabs/types/invoice_response_model.py @@ -4,7 +4,7 @@ import typing from ..core.datetime_utils import serialize_datetime -from .invoice_response_model_currency import InvoiceResponseModelCurrency +from .currency import Currency from .subscription_status import SubscriptionStatus try: @@ -14,23 +14,23 @@ class InvoiceResponseModel(pydantic.BaseModel): - tier: typing.Optional[str] - character_count: typing.Optional[int] - character_limit: typing.Optional[int] - can_extend_character_limit: typing.Optional[bool] - allowed_to_extend_character_limit: typing.Optional[bool] - next_character_count_reset_unix: typing.Optional[int] - voice_limit: typing.Optional[int] - max_voice_add_edits: typing.Optional[int] - voice_add_edit_counter: typing.Optional[int] - professional_voice_limit: typing.Optional[int] - can_extend_voice_limit: typing.Optional[bool] - can_use_instant_voice_cloning: typing.Optional[bool] - can_use_professional_voice_cloning: typing.Optional[bool] - status: typing.Optional[SubscriptionStatus] + tier: str + character_count: int + character_limit: int + can_extend_character_limit: bool + allowed_to_extend_character_limit: bool + next_character_count_reset_unix: int + voice_limit: int + max_voice_add_edits: int + voice_add_edit_counter: int + professional_voice_limit: int + can_extend_voice_limit: bool + can_use_instant_voice_cloning: bool + can_use_professional_voice_cloning: bool + status: SubscriptionStatus amount_due_cents: int next_payment_attempt_unix: int - currency: typing.Optional[InvoiceResponseModelCurrency] + currency: typing.Optional[Currency] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/invoice_response_model_currency.py b/src/elevenlabs/types/invoice_response_model_currency.py deleted file mode 100644 index c0d102e..0000000 --- a/src/elevenlabs/types/invoice_response_model_currency.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class InvoiceResponseModelCurrency(str, enum.Enum): - USD = "usd" - EUR = "eur" - - def visit(self, usd: typing.Callable[[], T_Result], eur: typing.Callable[[], T_Result]) -> T_Result: - if self is InvoiceResponseModelCurrency.USD: - return usd() - if self is InvoiceResponseModelCurrency.EUR: - return eur() diff --git a/src/elevenlabs/types/history_item_state.py b/src/elevenlabs/types/item_state.py similarity index 73% rename from src/elevenlabs/types/history_item_state.py rename to src/elevenlabs/types/item_state.py index b3a283b..8211786 100644 --- a/src/elevenlabs/types/history_item_state.py +++ b/src/elevenlabs/types/item_state.py @@ -6,7 +6,7 @@ T_Result = typing.TypeVar("T_Result") -class HistoryItemState(str, enum.Enum): +class ItemState(str, enum.Enum): CREATED = "created" DELETED = "deleted" PROCESSING = "processing" @@ -17,9 +17,9 @@ def visit( deleted: typing.Callable[[], T_Result], processing: typing.Callable[[], T_Result], ) -> T_Result: - if self is HistoryItemState.CREATED: + if self is ItemState.CREATED: return created() - if self is HistoryItemState.DELETED: + if self is ItemState.DELETED: return deleted() - if self is HistoryItemState.PROCESSING: + if self is ItemState.PROCESSING: return processing() diff --git a/src/elevenlabs/types/model.py b/src/elevenlabs/types/model_response.py similarity index 57% rename from src/elevenlabs/types/model.py rename to src/elevenlabs/types/model_response.py index f54554e..2f201eb 100644 --- a/src/elevenlabs/types/model.py +++ b/src/elevenlabs/types/model_response.py @@ -12,21 +12,21 @@ import pydantic # type: ignore -class Model(pydantic.BaseModel): +class ModelResponse(pydantic.BaseModel): model_id: str - name: typing.Optional[str] - can_be_finetuned: typing.Optional[bool] - can_do_text_to_speech: typing.Optional[bool] - can_do_voice_conversion: typing.Optional[bool] - can_use_style: typing.Optional[bool] - can_use_speaker_boost: typing.Optional[bool] - serves_pro_voices: typing.Optional[bool] - token_cost_factor: typing.Optional[float] - description: typing.Optional[str] - requires_alpha_access: typing.Optional[bool] - max_characters_request_free_user: typing.Optional[int] - max_characters_request_subscribed_user: typing.Optional[int] - languages: typing.Optional[typing.List[LanguageResponseModel]] + name: str + can_be_finetuned: bool + can_do_text_to_speech: bool + can_do_voice_conversion: bool + can_use_style: bool + can_use_speaker_boost: bool + serves_pro_voices: bool + token_cost_factor: float + description: str + requires_alpha_access: bool + max_characters_request_free_user: int + max_characters_request_subscribed_user: int + languages: typing.List[LanguageResponseModel] def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/project_extended_response_model.py b/src/elevenlabs/types/project_extended_response_model.py index b28307b..7ca5cf7 100644 --- a/src/elevenlabs/types/project_extended_response_model.py +++ b/src/elevenlabs/types/project_extended_response_model.py @@ -23,7 +23,7 @@ class ProjectExtendedResponseModel(pydantic.BaseModel): can_be_downloaded: bool state: ProjectState chapters: typing.List[ChapterResponseModel] - last_conversion_date_unix: typing.Optional[int] + last_conversion_date_unix: typing.Optional[int] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/project_response_model.py b/src/elevenlabs/types/project_response_model.py index 70f5724..0ee587e 100644 --- a/src/elevenlabs/types/project_response_model.py +++ b/src/elevenlabs/types/project_response_model.py @@ -22,10 +22,10 @@ class ProjectResponseModel(pydantic.BaseModel): can_be_downloaded: bool acx_volume_normalization: bool state: ProjectState - last_conversion_date_unix: typing.Optional[int] - title: typing.Optional[str] - author: typing.Optional[str] - isbn_number: typing.Optional[str] + last_conversion_date_unix: typing.Optional[int] = None + title: typing.Optional[str] = None + author: typing.Optional[str] = None + isbn_number: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/voice_sample.py b/src/elevenlabs/types/sample_response_model.py similarity index 79% rename from src/elevenlabs/types/voice_sample.py rename to src/elevenlabs/types/sample_response_model.py index 20da21e..b8eee71 100644 --- a/src/elevenlabs/types/voice_sample.py +++ b/src/elevenlabs/types/sample_response_model.py @@ -11,12 +11,12 @@ import pydantic # type: ignore -class VoiceSample(pydantic.BaseModel): - sample_id: typing.Optional[str] - file_name: typing.Optional[str] - mime_type: typing.Optional[str] - size_bytes: typing.Optional[int] - hash: typing.Optional[str] +class SampleResponseModel(pydantic.BaseModel): + sample_id: str + file_name: str + mime_type: str + size_bytes: int + hash: str def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/chapter_response_model_state.py b/src/elevenlabs/types/state.py similarity index 69% rename from src/elevenlabs/types/chapter_response_model_state.py rename to src/elevenlabs/types/state.py index f5045bf..00df64c 100644 --- a/src/elevenlabs/types/chapter_response_model_state.py +++ b/src/elevenlabs/types/state.py @@ -6,12 +6,12 @@ T_Result = typing.TypeVar("T_Result") -class ChapterResponseModelState(str, enum.Enum): +class State(str, enum.Enum): DEFAULT = "default" CONVERTING = "converting" def visit(self, default: typing.Callable[[], T_Result], converting: typing.Callable[[], T_Result]) -> T_Result: - if self is ChapterResponseModelState.DEFAULT: + if self is State.DEFAULT: return default() - if self is ChapterResponseModelState.CONVERTING: + if self is State.CONVERTING: return converting() diff --git a/src/elevenlabs/types/subscription_response.py b/src/elevenlabs/types/subscription_response.py index f52c5be..e52cfb8 100644 --- a/src/elevenlabs/types/subscription_response.py +++ b/src/elevenlabs/types/subscription_response.py @@ -28,7 +28,7 @@ class SubscriptionResponse(pydantic.BaseModel): can_use_instant_voice_cloning: bool can_use_professional_voice_cloning: bool status: SubscriptionStatus - currency: typing.Optional[Currency] + currency: typing.Optional[Currency] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/user.py b/src/elevenlabs/types/user_response.py similarity index 96% rename from src/elevenlabs/types/user.py rename to src/elevenlabs/types/user_response.py index 1c88b22..207fb67 100644 --- a/src/elevenlabs/types/user.py +++ b/src/elevenlabs/types/user_response.py @@ -12,7 +12,7 @@ import pydantic # type: ignore -class User(pydantic.BaseModel): +class UserResponse(pydantic.BaseModel): subscription: SubscriptionResponse is_new_user: bool xi_api_key: str diff --git a/src/elevenlabs/types/verification_attempt_response_model.py b/src/elevenlabs/types/verification_attempt_response_model.py index 1fe8608..8f50a3b 100644 --- a/src/elevenlabs/types/verification_attempt_response_model.py +++ b/src/elevenlabs/types/verification_attempt_response_model.py @@ -18,7 +18,7 @@ class VerificationAttemptResponseModel(pydantic.BaseModel): accepted: bool similarity: float levenshtein_distance: float - recording: typing.Optional[RecordingResponseModel] + recording: typing.Optional[RecordingResponseModel] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/voice_response.py b/src/elevenlabs/types/voice_response.py index d21abd9..cd0c81d 100644 --- a/src/elevenlabs/types/voice_response.py +++ b/src/elevenlabs/types/voice_response.py @@ -5,7 +5,7 @@ from ..core.datetime_utils import serialize_datetime from .fine_tuning_response_model import FineTuningResponseModel -from .voice_sample import VoiceSample +from .sample_response_model import SampleResponseModel from .voice_settings import VoiceSettings from .voice_sharing_response_model import VoiceSharingResponseModel @@ -22,12 +22,12 @@ class VoiceResponse(pydantic.BaseModel): labels: typing.Dict[str, str] available_for_tiers: typing.List[str] high_quality_base_model_ids: typing.List[str] - samples: typing.Optional[typing.List[VoiceSample]] - fine_tuning: typing.Optional[FineTuningResponseModel] - description: typing.Optional[str] - preview_url: typing.Optional[str] - settings: typing.Optional[VoiceSettings] - sharing: typing.Optional[VoiceSharingResponseModel] + samples: typing.Optional[typing.List[SampleResponseModel]] = None + fine_tuning: typing.Optional[FineTuningResponseModel] = None + description: typing.Optional[str] = None + preview_url: typing.Optional[str] = None + settings: typing.Optional[VoiceSettings] = None + sharing: typing.Optional[VoiceSharingResponseModel] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/voice_settings.py b/src/elevenlabs/types/voice_settings.py index be74056..95189ec 100644 --- a/src/elevenlabs/types/voice_settings.py +++ b/src/elevenlabs/types/voice_settings.py @@ -12,10 +12,10 @@ class VoiceSettings(pydantic.BaseModel): - stability: typing.Optional[float] - similarity_boost: typing.Optional[float] - style: typing.Optional[float] - use_speaker_boost: typing.Optional[bool] + stability: float + similarity_boost: float + style: typing.Optional[float] = None + use_speaker_boost: typing.Optional[bool] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/types/voice_sharing_response_model.py b/src/elevenlabs/types/voice_sharing_response_model.py index e6028a6..7ef4741 100644 --- a/src/elevenlabs/types/voice_sharing_response_model.py +++ b/src/elevenlabs/types/voice_sharing_response_model.py @@ -25,9 +25,9 @@ class VoiceSharingResponseModel(pydantic.BaseModel): financial_rewards_enabled: bool name: str labels: typing.Dict[str, str] - description: typing.Optional[str] - history_item_sample_id: typing.Optional[str] - review_message: typing.Optional[str] + description: typing.Optional[str] = None + history_item_sample_id: typing.Optional[str] = None + review_message: typing.Optional[str] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/elevenlabs/resources/user/__init__.py b/src/elevenlabs/user/__init__.py similarity index 100% rename from src/elevenlabs/resources/user/__init__.py rename to src/elevenlabs/user/__init__.py diff --git a/src/elevenlabs/user/client.py b/src/elevenlabs/user/client.py new file mode 100644 index 0000000..9f5b7f8 --- /dev/null +++ b/src/elevenlabs/user/client.py @@ -0,0 +1,210 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.extended_subscription_response_model import ExtendedSubscriptionResponseModel +from ..types.http_validation_error import HttpValidationError +from ..types.user_response import UserResponse + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class UserClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_subscription( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ExtendedSubscriptionResponseModel: + """ + Gets extended information about the users subscription + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.user.get_subscription() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user/subscription"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ExtendedSubscriptionResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> UserResponse: + """ + Gets information about the user + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.user.get() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(UserResponse, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncUserClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_subscription( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ExtendedSubscriptionResponseModel: + """ + Gets extended information about the users subscription + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.user.get_subscription() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user/subscription"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(ExtendedSubscriptionResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> UserResponse: + """ + Gets information about the user + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.user.get() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/user"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(UserResponse, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/elevenlabs/voice.py b/src/elevenlabs/voice.py deleted file mode 100644 index 7ce3cba..0000000 --- a/src/elevenlabs/voice.py +++ /dev/null @@ -1,44 +0,0 @@ -import httpx -from typing import Dict, List, Optional - -from elevenlabs import environment - -from .core.jsonable_encoder import jsonable_encoder -from .client import ElevenLabs -from .types import ( - GetVoicesResponseModel, - VoiceSettings, - VoiceSample, - Age, - Gender, - Accent - ) - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class Voice(pydantic.BaseModel): - voice_id: str - name: Optional[str] = None - category: Optional[str] = None - description: Optional[str] = None - labels: Optional[Dict[str, str]] = None - samples: Optional[List[VoiceSample]] = None - preview_url: Optional[str] = None - settings: Optional[VoiceSettings] = None - - -def voices() -> List[Voice]: - client = ElevenLabs() - response = client.voices.get_all() - return [Voice(**voice.dict()) for voice in response.voices] - - -class VoiceClone(pydantic.BaseModel): - name: str - description: str = "" - files: List[str] - labels: Optional[Dict[str, str]] = None diff --git a/src/elevenlabs/resources/voices/__init__.py b/src/elevenlabs/voices/__init__.py similarity index 100% rename from src/elevenlabs/resources/voices/__init__.py rename to src/elevenlabs/voices/__init__.py diff --git a/src/elevenlabs/voices/client.py b/src/elevenlabs/voices/client.py new file mode 100644 index 0000000..7a7b48f --- /dev/null +++ b/src/elevenlabs/voices/client.py @@ -0,0 +1,920 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.jsonable_encoder import jsonable_encoder +from ..core.remove_none_from_dict import remove_none_from_dict +from ..core.request_options import RequestOptions +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_voice_response_model import AddVoiceResponseModel +from ..types.get_voices_response_model import GetVoicesResponseModel +from ..types.http_validation_error import HttpValidationError +from ..types.voice_response import VoiceResponse +from ..types.voice_settings import VoiceSettings + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VoicesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetVoicesResponseModel: + """ + Gets a list of all available voices for a user. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get_all() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetVoicesResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_default_settings(self, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get_default_settings() + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/settings/default"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_settings(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get_settings( + voice_id="voice_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/settings" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceResponse: + """ + Returns metadata about a specific voice. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - with_settings: typing.Optional[bool]. If set will return settings information corresponding to the voice, requires authorization. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get( + voice_id="voice_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}"), + params=jsonable_encoder( + remove_none_from_dict( + { + "with_settings": with_settings, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceResponse, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def delete_v_1_voices( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Deletes a voice by its ID. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.delete_v_1_voices( + voice_id="voice_id", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def edit_settings( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request: VoiceSettings. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs import VoiceSettings + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.edit_settings( + voice_id="voice_id", + request=VoiceSettings( + stability=1.1, + similarity_boost=1.1, + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/settings/edit" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def add( + self, + *, + name: str, + files: typing.List[core.File], + description: str, + labels: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Add a new voice to your collection of voices in VoiceLab. + + Parameters: + - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. + + - files: typing.List[core.File]. See core.File for more documentation + + - description: str. How would you describe the voice? + + - labels: str. Serialized labels dictionary for the voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/add"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddVoiceResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def edit( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = None, + description: str, + labels: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Edit a voice created by you. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. + + - files: typing.Optional[typing.List[core.File]]. See core.File for more documentation + + - description: str. How would you describe the voice? + + - labels: str. Serialized labels dictionary for the voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/edit" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncVoicesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_all(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetVoicesResponseModel: + """ + Gets a list of all available voices for a user. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.get_all() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(GetVoicesResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_default_settings(self, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.get_default_settings() + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/settings/default"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_settings( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceSettings: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.get_settings( + voice_id="voice_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/settings" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceSettings, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceResponse: + """ + Returns metadata about a specific voice. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - with_settings: typing.Optional[bool]. If set will return settings information corresponding to the voice, requires authorization. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.get( + voice_id="voice_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}"), + params=jsonable_encoder( + remove_none_from_dict( + { + "with_settings": with_settings, + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + } + ) + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(VoiceResponse, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def delete_v_1_voices( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Deletes a voice by its ID. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.delete_v_1_voices( + voice_id="voice_id", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "DELETE", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def edit_settings( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - request: VoiceSettings. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs import VoiceSettings + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + await client.voices.edit_settings( + voice_id="voice_id", + request=VoiceSettings( + stability=1.1, + similarity_boost=1.1, + ), + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/settings/edit" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + json=jsonable_encoder(request) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(request), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def add( + self, + *, + name: str, + files: typing.List[core.File], + description: str, + labels: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Add a new voice to your collection of voices in VoiceLab. + + Parameters: + - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. + + - files: typing.List[core.File]. See core.File for more documentation + + - description: str. How would you describe the voice? + + - labels: str. Serialized labels dictionary for the voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/voices/add"), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(AddVoiceResponseModel, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def edit( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = None, + description: str, + labels: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Edit a voice created by you. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - name: str. The name that identifies this voice. This will be displayed in the dropdown of the website. + + - files: typing.Optional[typing.List[core.File]]. See core.File for more documentation + + - description: str. How would you describe the voice? + + - labels: str. Serialized labels dictionary for the voice. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"v1/voices/{jsonable_encoder(voice_id)}/edit" + ), + params=jsonable_encoder( + request_options.get("additional_query_parameters") if request_options is not None else None + ), + data=jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})) + if request_options is None or request_options.get("additional_body_parameters") is None + else { + **jsonable_encoder(remove_none_from_dict({"name": name, "description": description, "labels": labels})), + **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), + }, + files=core.convert_file_dict_to_httpx_tuples(remove_none_from_dict({"files": files})), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + timeout=request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else 60, + retries=0, + max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json)