diff --git a/Makefile b/Makefile index 61b9697..774463d 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ style-check: .PHONY: test test: - poetry run pytest -x tests + poetry install + poetry run pytest tests .PHONY: docs docs: diff --git a/poetry.lock b/poetry.lock index d9dea5c..bbf1928 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,37 +1,40 @@ -# This file is automatically @generated by Poetry 1.6.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.6.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +files = [ + {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] +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)"] - -[[package]] -name = "appdirs" -version = "1.4.4" -description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -optional = false -python-versions = "*" -files = [ - {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, - {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, -] +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 = "atomicwrites" @@ -45,74 +48,93 @@ files = [ [[package]] name = "attrs" -version = "23.1.0" +version = "23.2.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.7" files = [ - {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"}, - {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, + {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, + {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, ] -[package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} - [package.extras] cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] -dev = ["attrs[docs,tests]", "pre-commit"] +dev = ["attrs[tests]", "pre-commit"] docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] tests = ["attrs[tests-no-zope]", "zope-interface"] -tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] +tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] [[package]] name = "black" -version = "20.8b1" +version = "24.2.0" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.6" -files = [ - {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, +python-versions = ">=3.8" +files = [ + {file = "black-24.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6981eae48b3b33399c8757036c7f5d48a535b962a7c2310d19361edeef64ce29"}, + {file = "black-24.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d533d5e3259720fdbc1b37444491b024003e012c5173f7d06825a77508085430"}, + {file = "black-24.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61a0391772490ddfb8a693c067df1ef5227257e72b0e4108482b8d41b5aee13f"}, + {file = "black-24.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:992e451b04667116680cb88f63449267c13e1ad134f30087dec8527242e9862a"}, + {file = "black-24.2.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:163baf4ef40e6897a2a9b83890e59141cc8c2a98f2dda5080dc15c00ee1e62cd"}, + {file = "black-24.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e37c99f89929af50ffaf912454b3e3b47fd64109659026b678c091a4cd450fb2"}, + {file = "black-24.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f9de21bafcba9683853f6c96c2d515e364aee631b178eaa5145fc1c61a3cc92"}, + {file = "black-24.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:9db528bccb9e8e20c08e716b3b09c6bdd64da0dd129b11e160bf082d4642ac23"}, + {file = "black-24.2.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d84f29eb3ee44859052073b7636533ec995bd0f64e2fb43aeceefc70090e752b"}, + {file = "black-24.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e08fb9a15c914b81dd734ddd7fb10513016e5ce7e6704bdd5e1251ceee51ac9"}, + {file = "black-24.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:810d445ae6069ce64030c78ff6127cd9cd178a9ac3361435708b907d8a04c693"}, + {file = "black-24.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:ba15742a13de85e9b8f3239c8f807723991fbfae24bad92d34a2b12e81904982"}, + {file = "black-24.2.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7e53a8c630f71db01b28cd9602a1ada68c937cbf2c333e6ed041390d6968faf4"}, + {file = "black-24.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93601c2deb321b4bad8f95df408e3fb3943d85012dddb6121336b8e24a0d1218"}, + {file = "black-24.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a0057f800de6acc4407fe75bb147b0c2b5cbb7c3ed110d3e5999cd01184d53b0"}, + {file = "black-24.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:faf2ee02e6612577ba0181f4347bcbcf591eb122f7841ae5ba233d12c39dcb4d"}, + {file = "black-24.2.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:057c3dc602eaa6fdc451069bd027a1b2635028b575a6c3acfd63193ced20d9c8"}, + {file = "black-24.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:08654d0797e65f2423f850fc8e16a0ce50925f9337fb4a4a176a7aa4026e63f8"}, + {file = "black-24.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ca610d29415ee1a30a3f30fab7a8f4144e9d34c89a235d81292a1edb2b55f540"}, + {file = "black-24.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:4dd76e9468d5536abd40ffbc7a247f83b2324f0c050556d9c371c2b9a9a95e31"}, + {file = "black-24.2.0-py3-none-any.whl", hash = "sha256:e8a6ae970537e67830776488bca52000eaa37fa63b9988e8c487458d9cd5ace6"}, + {file = "black-24.2.0.tar.gz", hash = "sha256:bce4f25c27c3435e4dace4815bcb2008b87e167e3bf4ee47ccdc5ce906eb4894"}, ] [package.dependencies] -appdirs = "*" -click = ">=7.1.2" +click = ">=8.0.0" mypy-extensions = ">=0.4.3" -pathspec = ">=0.6,<1" -regex = ">=2020.1.8" -toml = ">=0.10.1" -typed-ast = ">=1.4.0" -typing-extensions = ">=3.7.4" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2023.7.22" +version = "2024.2.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, - {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, + {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, + {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] [[package]] name = "click" -version = "8.1.7" +version = "8.0.2" description = "Composable command line interface toolkit" optional = false -python-versions = ">=3.7" +python-versions = ">=3.6" files = [ - {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, - {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, + {file = "click-8.0.2-py3-none-any.whl", hash = "sha256:3fab8aeb8f15f5452ae7511ad448977b3417325bceddd53df87e0bb81f3a8cf8"}, + {file = "click-8.0.2.tar.gz", hash = "sha256:7027bc7bbafaab8b2c2816861d8eb372429ee3c02e193fc2f93d6c4ab9de49c5"}, ] [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" @@ -127,13 +149,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.1.3" +version = "1.2.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, - {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, ] [package.extras] @@ -151,7 +173,6 @@ files = [ ] [package.dependencies] -importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.7.0,<2.8.0" pyflakes = ">=2.3.0,<2.4.0" @@ -167,9 +188,6 @@ 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.16.3" @@ -216,35 +234,15 @@ socks = ["socksio (==1.*)"] [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, -] - -[[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"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] -[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" @@ -291,40 +289,52 @@ files = [ [[package]] name = "packaging" -version = "23.1" +version = "24.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.7" files = [ - {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, - {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, + {file = "packaging-24.0-py3-none-any.whl", hash = "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5"}, + {file = "packaging-24.0.tar.gz", hash = "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9"}, ] [[package]] name = "pathspec" -version = "0.11.2" +version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" +files = [ + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, +] + +[[package]] +name = "platformdirs" +version = "4.2.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +optional = false +python-versions = ">=3.8" files = [ - {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"}, - {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, + {file = "platformdirs-4.2.0-py3-none-any.whl", hash = "sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068"}, + {file = "platformdirs-4.2.0.tar.gz", hash = "sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768"}, ] +[package.extras] +docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] + [[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"] @@ -353,55 +363,132 @@ files = [ [[package]] name = "pydantic" -version = "1.10.12" -description = "Data validation and settings management using python type hints" +version = "2.6.3" +description = "Data validation using Python type hints" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pydantic-1.10.12-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a1fcb59f2f355ec350073af41d927bf83a63b50e640f4dbaa01053a28b7a7718"}, - {file = "pydantic-1.10.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b7ccf02d7eb340b216ec33e53a3a629856afe1c6e0ef91d84a4e6f2fb2ca70fe"}, - {file = "pydantic-1.10.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8fb2aa3ab3728d950bcc885a2e9eff6c8fc40bc0b7bb434e555c215491bcf48b"}, - {file = "pydantic-1.10.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:771735dc43cf8383959dc9b90aa281f0b6092321ca98677c5fb6125a6f56d58d"}, - {file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ca48477862372ac3770969b9d75f1bf66131d386dba79506c46d75e6b48c1e09"}, - {file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a5e7add47a5b5a40c49b3036d464e3c7802f8ae0d1e66035ea16aa5b7a3923ed"}, - {file = "pydantic-1.10.12-cp310-cp310-win_amd64.whl", hash = "sha256:e4129b528c6baa99a429f97ce733fff478ec955513630e61b49804b6cf9b224a"}, - {file = "pydantic-1.10.12-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b0d191db0f92dfcb1dec210ca244fdae5cbe918c6050b342d619c09d31eea0cc"}, - {file = "pydantic-1.10.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:795e34e6cc065f8f498c89b894a3c6da294a936ee71e644e4bd44de048af1405"}, - {file = "pydantic-1.10.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:69328e15cfda2c392da4e713443c7dbffa1505bc9d566e71e55abe14c97ddc62"}, - {file = "pydantic-1.10.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2031de0967c279df0d8a1c72b4ffc411ecd06bac607a212892757db7462fc494"}, - {file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ba5b2e6fe6ca2b7e013398bc7d7b170e21cce322d266ffcd57cca313e54fb246"}, - {file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2a7bac939fa326db1ab741c9d7f44c565a1d1e80908b3797f7f81a4f86bc8d33"}, - {file = "pydantic-1.10.12-cp311-cp311-win_amd64.whl", hash = "sha256:87afda5539d5140cb8ba9e8b8c8865cb5b1463924d38490d73d3ccfd80896b3f"}, - {file = "pydantic-1.10.12-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:549a8e3d81df0a85226963611950b12d2d334f214436a19537b2efed61b7639a"}, - {file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:598da88dfa127b666852bef6d0d796573a8cf5009ffd62104094a4fe39599565"}, - {file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ba5c4a8552bff16c61882db58544116d021d0b31ee7c66958d14cf386a5b5350"}, - {file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c79e6a11a07da7374f46970410b41d5e266f7f38f6a17a9c4823db80dadf4303"}, - {file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ab26038b8375581dc832a63c948f261ae0aa21f1d34c1293469f135fa92972a5"}, - {file = "pydantic-1.10.12-cp37-cp37m-win_amd64.whl", hash = "sha256:e0a16d274b588767602b7646fa05af2782576a6cf1022f4ba74cbb4db66f6ca8"}, - {file = "pydantic-1.10.12-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6a9dfa722316f4acf4460afdf5d41d5246a80e249c7ff475c43a3a1e9d75cf62"}, - {file = "pydantic-1.10.12-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a73f489aebd0c2121ed974054cb2759af8a9f747de120acd2c3394cf84176ccb"}, - {file = "pydantic-1.10.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b30bcb8cbfccfcf02acb8f1a261143fab622831d9c0989707e0e659f77a18e0"}, - {file = "pydantic-1.10.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fcfb5296d7877af406ba1547dfde9943b1256d8928732267e2653c26938cd9c"}, - {file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2f9a6fab5f82ada41d56b0602606a5506aab165ca54e52bc4545028382ef1c5d"}, - {file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dea7adcc33d5d105896401a1f37d56b47d443a2b2605ff8a969a0ed5543f7e33"}, - {file = "pydantic-1.10.12-cp38-cp38-win_amd64.whl", hash = "sha256:1eb2085c13bce1612da8537b2d90f549c8cbb05c67e8f22854e201bde5d98a47"}, - {file = "pydantic-1.10.12-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ef6c96b2baa2100ec91a4b428f80d8f28a3c9e53568219b6c298c1125572ebc6"}, - {file = "pydantic-1.10.12-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6c076be61cd0177a8433c0adcb03475baf4ee91edf5a4e550161ad57fc90f523"}, - {file = "pydantic-1.10.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d5a58feb9a39f481eda4d5ca220aa8b9d4f21a41274760b9bc66bfd72595b86"}, - {file = "pydantic-1.10.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5f805d2d5d0a41633651a73fa4ecdd0b3d7a49de4ec3fadf062fe16501ddbf1"}, - {file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:1289c180abd4bd4555bb927c42ee42abc3aee02b0fb2d1223fb7c6e5bef87dbe"}, - {file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5d1197e462e0364906cbc19681605cb7c036f2475c899b6f296104ad42b9f5fb"}, - {file = "pydantic-1.10.12-cp39-cp39-win_amd64.whl", hash = "sha256:fdbdd1d630195689f325c9ef1a12900524dceb503b00a987663ff4f58669b93d"}, - {file = "pydantic-1.10.12-py3-none-any.whl", hash = "sha256:b749a43aa51e32839c9d71dc67eb1e4221bb04af1033a32e3923d46f9effa942"}, - {file = "pydantic-1.10.12.tar.gz", hash = "sha256:0fe8a415cea8f340e7a9af9c54fc71a649b43e8ca3cc732986116b3cb135d303"}, + {file = "pydantic-2.6.3-py3-none-any.whl", hash = "sha256:72c6034df47f46ccdf81869fddb81aade68056003900a8724a4f160700016a2a"}, + {file = "pydantic-2.6.3.tar.gz", hash = "sha256:e07805c4c7f5c6826e33a1d4c9d47950d7eaf34868e2690f8594d2e30241f11f"}, ] [package.dependencies] -typing-extensions = ">=4.2.0" +annotated-types = ">=0.4.0" +pydantic-core = "2.16.3" +typing-extensions = ">=4.6.1" [package.extras] -dotenv = ["python-dotenv (>=0.10.4)"] -email = ["email-validator (>=1.0.3)"] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.16.3" +description = "" +optional = false +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] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pydantic-settings" +version = "2.2.1" +description = "Settings management using Pydantic" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_settings-2.2.1-py3-none-any.whl", hash = "sha256:0235391d26db4d2190cb9b31051c4b46882d28a51533f97440867f012d4da091"}, + {file = "pydantic_settings-2.2.1.tar.gz", hash = "sha256:00b9f6a5e95553590434c0fa01ead0b216c3e10bc54ae02e37f359948643c5ed"}, +] + +[package.dependencies] +pydantic = ">=2.3.0" +python-dotenv = ">=0.21.0" + +[package.extras] +toml = ["tomli (>=2.0.1)"] +yaml = ["pyyaml (>=6.0.1)"] [[package]] name = "pyflakes" @@ -425,9 +512,6 @@ files = [ {file = "PyJWT-2.8.0.tar.gz", hash = "sha256:57e28d156e3d5c10088e0c68abb90bfac3df82b40a71bd0daa20c65ccd5c23de"}, ] -[package.dependencies] -typing-extensions = {version = "*", markers = "python_version <= \"3.7\""} - [package.extras] crypto = ["cryptography (>=3.4.0)"] dev = ["coverage[toml] (==5.0.4)", "cryptography (>=3.4.0)", "pre-commit", "pytest (>=6.0.0,<7.0.0)", "sphinx (>=4.5.0,<5.0.0)", "sphinx-rtd-theme", "zope.interface"] @@ -449,7 +533,6 @@ files = [ atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -478,115 +561,32 @@ testing = ["async-generator (>=1.3)", "coverage", "hypothesis (>=5.7.1)"] [[package]] name = "python-dateutil" -version = "2.8.2" +version = "2.9.0.post0" description = "Extensions to the standard Python datetime module" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, ] [package.dependencies] six = ">=1.5" [[package]] -name = "regex" -version = "2023.8.8" -description = "Alternative regular expression module, to replace re." +name = "python-dotenv" +version = "1.0.1" +description = "Read key-value pairs from a .env file and set them as environment variables" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "regex-2023.8.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:88900f521c645f784260a8d346e12a1590f79e96403971241e64c3a265c8ecdb"}, - {file = "regex-2023.8.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3611576aff55918af2697410ff0293d6071b7e00f4b09e005d614686ac4cd57c"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b8a0ccc8f2698f120e9e5742f4b38dc944c38744d4bdfc427616f3a163dd9de5"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c662a4cbdd6280ee56f841f14620787215a171c4e2d1744c9528bed8f5816c96"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cf0633e4a1b667bfe0bb10b5e53fe0d5f34a6243ea2530eb342491f1adf4f739"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:551ad543fa19e94943c5b2cebc54c73353ffff08228ee5f3376bd27b3d5b9800"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54de2619f5ea58474f2ac211ceea6b615af2d7e4306220d4f3fe690c91988a61"}, - {file = "regex-2023.8.8-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5ec4b3f0aebbbe2fc0134ee30a791af522a92ad9f164858805a77442d7d18570"}, - {file = "regex-2023.8.8-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:3ae646c35cb9f820491760ac62c25b6d6b496757fda2d51be429e0e7b67ae0ab"}, - {file = "regex-2023.8.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ca339088839582d01654e6f83a637a4b8194d0960477b9769d2ff2cfa0fa36d2"}, - {file = "regex-2023.8.8-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:d9b6627408021452dcd0d2cdf8da0534e19d93d070bfa8b6b4176f99711e7f90"}, - {file = "regex-2023.8.8-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:bd3366aceedf274f765a3a4bc95d6cd97b130d1dda524d8f25225d14123c01db"}, - {file = "regex-2023.8.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7aed90a72fc3654fba9bc4b7f851571dcc368120432ad68b226bd593f3f6c0b7"}, - {file = "regex-2023.8.8-cp310-cp310-win32.whl", hash = "sha256:80b80b889cb767cc47f31d2b2f3dec2db8126fbcd0cff31b3925b4dc6609dcdb"}, - {file = "regex-2023.8.8-cp310-cp310-win_amd64.whl", hash = "sha256:b82edc98d107cbc7357da7a5a695901b47d6eb0420e587256ba3ad24b80b7d0b"}, - {file = "regex-2023.8.8-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1e7d84d64c84ad97bf06f3c8cb5e48941f135ace28f450d86af6b6512f1c9a71"}, - {file = "regex-2023.8.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ce0f9fbe7d295f9922c0424a3637b88c6c472b75eafeaff6f910494a1fa719ef"}, - {file = "regex-2023.8.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:06c57e14ac723b04458df5956cfb7e2d9caa6e9d353c0b4c7d5d54fcb1325c46"}, - {file = "regex-2023.8.8-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e7a9aaa5a1267125eef22cef3b63484c3241aaec6f48949b366d26c7250e0357"}, - {file = "regex-2023.8.8-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b7408511fca48a82a119d78a77c2f5eb1b22fe88b0d2450ed0756d194fe7a9a"}, - {file = "regex-2023.8.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14dc6f2d88192a67d708341f3085df6a4f5a0c7b03dec08d763ca2cd86e9f559"}, - {file = "regex-2023.8.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48c640b99213643d141550326f34f0502fedb1798adb3c9eb79650b1ecb2f177"}, - {file = "regex-2023.8.8-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0085da0f6c6393428bf0d9c08d8b1874d805bb55e17cb1dfa5ddb7cfb11140bf"}, - {file = "regex-2023.8.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:964b16dcc10c79a4a2be9f1273fcc2684a9eedb3906439720598029a797b46e6"}, - {file = "regex-2023.8.8-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:7ce606c14bb195b0e5108544b540e2c5faed6843367e4ab3deb5c6aa5e681208"}, - {file = "regex-2023.8.8-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:40f029d73b10fac448c73d6eb33d57b34607f40116e9f6e9f0d32e9229b147d7"}, - {file = "regex-2023.8.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3b8e6ea6be6d64104d8e9afc34c151926f8182f84e7ac290a93925c0db004bfd"}, - {file = "regex-2023.8.8-cp311-cp311-win32.whl", hash = "sha256:942f8b1f3b223638b02df7df79140646c03938d488fbfb771824f3d05fc083a8"}, - {file = "regex-2023.8.8-cp311-cp311-win_amd64.whl", hash = "sha256:51d8ea2a3a1a8fe4f67de21b8b93757005213e8ac3917567872f2865185fa7fb"}, - {file = "regex-2023.8.8-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e951d1a8e9963ea51efd7f150450803e3b95db5939f994ad3d5edac2b6f6e2b4"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:704f63b774218207b8ccc6c47fcef5340741e5d839d11d606f70af93ee78e4d4"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:22283c769a7b01c8ac355d5be0715bf6929b6267619505e289f792b01304d898"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:91129ff1bb0619bc1f4ad19485718cc623a2dc433dff95baadbf89405c7f6b57"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de35342190deb7b866ad6ba5cbcccb2d22c0487ee0cbb251efef0843d705f0d4"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b993b6f524d1e274a5062488a43e3f9f8764ee9745ccd8e8193df743dbe5ee61"}, - {file = "regex-2023.8.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3026cbcf11d79095a32d9a13bbc572a458727bd5b1ca332df4a79faecd45281c"}, - {file = "regex-2023.8.8-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:293352710172239bf579c90a9864d0df57340b6fd21272345222fb6371bf82b3"}, - {file = "regex-2023.8.8-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:d909b5a3fff619dc7e48b6b1bedc2f30ec43033ba7af32f936c10839e81b9217"}, - {file = "regex-2023.8.8-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:3d370ff652323c5307d9c8e4c62efd1956fb08051b0e9210212bc51168b4ff56"}, - {file = "regex-2023.8.8-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:b076da1ed19dc37788f6a934c60adf97bd02c7eea461b73730513921a85d4235"}, - {file = "regex-2023.8.8-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:e9941a4ada58f6218694f382e43fdd256e97615db9da135e77359da257a7168b"}, - {file = "regex-2023.8.8-cp36-cp36m-win32.whl", hash = "sha256:a8c65c17aed7e15a0c824cdc63a6b104dfc530f6fa8cb6ac51c437af52b481c7"}, - {file = "regex-2023.8.8-cp36-cp36m-win_amd64.whl", hash = "sha256:aadf28046e77a72f30dcc1ab185639e8de7f4104b8cb5c6dfa5d8ed860e57236"}, - {file = "regex-2023.8.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:423adfa872b4908843ac3e7a30f957f5d5282944b81ca0a3b8a7ccbbfaa06103"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ae594c66f4a7e1ea67232a0846649a7c94c188d6c071ac0210c3e86a5f92109"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e51c80c168074faa793685656c38eb7a06cbad7774c8cbc3ea05552d615393d8"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:09b7f4c66aa9d1522b06e31a54f15581c37286237208df1345108fcf4e050c18"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e73e5243af12d9cd6a9d6a45a43570dbe2e5b1cdfc862f5ae2b031e44dd95a8"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:941460db8fe3bd613db52f05259c9336f5a47ccae7d7def44cc277184030a116"}, - {file = "regex-2023.8.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f0ccf3e01afeb412a1a9993049cb160d0352dba635bbca7762b2dc722aa5742a"}, - {file = "regex-2023.8.8-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:2e9216e0d2cdce7dbc9be48cb3eacb962740a09b011a116fd7af8c832ab116ca"}, - {file = "regex-2023.8.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:5cd9cd7170459b9223c5e592ac036e0704bee765706445c353d96f2890e816c8"}, - {file = "regex-2023.8.8-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:4873ef92e03a4309b3ccd8281454801b291b689f6ad45ef8c3658b6fa761d7ac"}, - {file = "regex-2023.8.8-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:239c3c2a339d3b3ddd51c2daef10874410917cd2b998f043c13e2084cb191684"}, - {file = "regex-2023.8.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:1005c60ed7037be0d9dea1f9c53cc42f836188227366370867222bda4c3c6bd7"}, - {file = "regex-2023.8.8-cp37-cp37m-win32.whl", hash = "sha256:e6bd1e9b95bc5614a7a9c9c44fde9539cba1c823b43a9f7bc11266446dd568e3"}, - {file = "regex-2023.8.8-cp37-cp37m-win_amd64.whl", hash = "sha256:9a96edd79661e93327cfeac4edec72a4046e14550a1d22aa0dd2e3ca52aec921"}, - {file = "regex-2023.8.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f2181c20ef18747d5f4a7ea513e09ea03bdd50884a11ce46066bb90fe4213675"}, - {file = "regex-2023.8.8-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a2ad5add903eb7cdde2b7c64aaca405f3957ab34f16594d2b78d53b8b1a6a7d6"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9233ac249b354c54146e392e8a451e465dd2d967fc773690811d3a8c240ac601"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:920974009fb37b20d32afcdf0227a2e707eb83fe418713f7a8b7de038b870d0b"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd2b6c5dfe0929b6c23dde9624483380b170b6e34ed79054ad131b20203a1a63"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:96979d753b1dc3b2169003e1854dc67bfc86edf93c01e84757927f810b8c3c93"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2ae54a338191e1356253e7883d9d19f8679b6143703086245fb14d1f20196be9"}, - {file = "regex-2023.8.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2162ae2eb8b079622176a81b65d486ba50b888271302190870b8cc488587d280"}, - {file = "regex-2023.8.8-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:c884d1a59e69e03b93cf0dfee8794c63d7de0ee8f7ffb76e5f75be8131b6400a"}, - {file = "regex-2023.8.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf9273e96f3ee2ac89ffcb17627a78f78e7516b08f94dc435844ae72576a276e"}, - {file = "regex-2023.8.8-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:83215147121e15d5f3a45d99abeed9cf1fe16869d5c233b08c56cdf75f43a504"}, - {file = "regex-2023.8.8-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:3f7454aa427b8ab9101f3787eb178057c5250478e39b99540cfc2b889c7d0586"}, - {file = "regex-2023.8.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f0640913d2c1044d97e30d7c41728195fc37e54d190c5385eacb52115127b882"}, - {file = "regex-2023.8.8-cp38-cp38-win32.whl", hash = "sha256:0c59122ceccb905a941fb23b087b8eafc5290bf983ebcb14d2301febcbe199c7"}, - {file = "regex-2023.8.8-cp38-cp38-win_amd64.whl", hash = "sha256:c12f6f67495ea05c3d542d119d270007090bad5b843f642d418eb601ec0fa7be"}, - {file = "regex-2023.8.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:82cd0a69cd28f6cc3789cc6adeb1027f79526b1ab50b1f6062bbc3a0ccb2dbc3"}, - {file = "regex-2023.8.8-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:bb34d1605f96a245fc39790a117ac1bac8de84ab7691637b26ab2c5efb8f228c"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:987b9ac04d0b38ef4f89fbc035e84a7efad9cdd5f1e29024f9289182c8d99e09"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9dd6082f4e2aec9b6a0927202c85bc1b09dcab113f97265127c1dc20e2e32495"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7eb95fe8222932c10d4436e7a6f7c99991e3fdd9f36c949eff16a69246dee2dc"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7098c524ba9f20717a56a8d551d2ed491ea89cbf37e540759ed3b776a4f8d6eb"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4b694430b3f00eb02c594ff5a16db30e054c1b9589a043fe9174584c6efa8033"}, - {file = "regex-2023.8.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:b2aeab3895d778155054abea5238d0eb9a72e9242bd4b43f42fd911ef9a13470"}, - {file = "regex-2023.8.8-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:988631b9d78b546e284478c2ec15c8a85960e262e247b35ca5eaf7ee22f6050a"}, - {file = "regex-2023.8.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:67ecd894e56a0c6108ec5ab1d8fa8418ec0cff45844a855966b875d1039a2e34"}, - {file = "regex-2023.8.8-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:14898830f0a0eb67cae2bbbc787c1a7d6e34ecc06fbd39d3af5fe29a4468e2c9"}, - {file = "regex-2023.8.8-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:f2200e00b62568cfd920127782c61bc1c546062a879cdc741cfcc6976668dfcf"}, - {file = "regex-2023.8.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9691a549c19c22d26a4f3b948071e93517bdf86e41b81d8c6ac8a964bb71e5a6"}, - {file = "regex-2023.8.8-cp39-cp39-win32.whl", hash = "sha256:6ab2ed84bf0137927846b37e882745a827458689eb969028af8032b1b3dac78e"}, - {file = "regex-2023.8.8-cp39-cp39-win_amd64.whl", hash = "sha256:5543c055d8ec7801901e1193a51570643d6a6ab8751b1f7dd9af71af467538bb"}, - {file = "regex-2023.8.8.tar.gz", hash = "sha256:fcbdc5f2b0f1cd0f6a56cdb46fe41d2cce1e644e3b68832f3eeebc5fb0f7712e"}, + {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, + {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, ] +[package.extras] +cli = ["click (>=5.0)"] + [[package]] name = "respx" version = "0.20.2" @@ -656,13 +656,13 @@ files = [ [[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]] @@ -677,82 +677,28 @@ files = [ ] [[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"}, -] - -[[package]] -name = "typing-extensions" -version = "4.7.1" -description = "Backported and Experimental Type Hints for Python 3.7+" +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" optional = false python-versions = ">=3.7" 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 = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] [[package]] -name = "zipp" -version = "3.15.0" -description = "Backport of pathlib-compatible object wrapper for zip files" +name = "typing-extensions" +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 = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, - {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, + {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.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 = "74b782528c8a32285edcd9156c19c04bae9838c31db60a22af877f826dec7c95" +python-versions = ">=3.8,<4.0" +content-hash = "2b999a8df501eb52a1c5cd5d06fb55b6c74f9510b50057f3861267adc7f157f3" diff --git a/pyproject.toml b/pyproject.toml index 0ac98e0..5e71e84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "qcs-api-client" -version = "0.24.1" +version = "0.25.0" description = "A client library for accessing the Rigetti QCS API" license = "Apache-2.0" repository = "https://github.com/rigetti/qcs-api-client-python" @@ -17,17 +17,19 @@ include = ["CHANGELOG.md", "qcs_api_client/py.typed"] attrs = ">=21.3.0" httpx = "^0.23.0" iso8601 = "^1.0.2" -pydantic = "^1.7.2" -python = "^3.7" +pydantic = "^2.6.3" +python = ">=3.8,<4.0" python-dateutil = "^2.8.1" retrying = "^1.3.3" rfc3339 = "^6.2" toml = "^0.10.2" PyJWT = "^2.4.0" +pydantic-settings = "^2.2.1" [tool.poetry.dev-dependencies] -black = "20.8b1" +black = "^24.2.0" +click = "8.0.2" flake8 = "^3.8.4" pytest = "^6.1.2" respx = "^0.20.0" diff --git a/qcs_api_client/__init__.py b/qcs_api_client/__init__.py index 3bc0c5d..8e354fb 100644 --- a/qcs_api_client/__init__.py +++ b/qcs_api_client/__init__.py @@ -1 +1 @@ -""" """ +"""A client library for accessing Rigetti QCS API""" diff --git a/qcs_api_client/api/__init__.py b/qcs_api_client/api/__init__.py index dc035f4..81f9fa2 100644 --- a/qcs_api_client/api/__init__.py +++ b/qcs_api_client/api/__init__.py @@ -1 +1 @@ -""" Contains methods for accessing the API """ +"""Contains methods for accessing the API""" diff --git a/qcs_api_client/api/account/add_group_user.py b/qcs_api_client/api/account/add_group_user.py index 12139e8..fc70c0b 100644 --- a/qcs_api_client/api/account/add_group_user.py +++ b/qcs_api_client/api/account/add_group_user.py @@ -1,51 +1,47 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.add_group_user_request import AddGroupUserRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.add_group_user_request import AddGroupUserRequest + def _get_kwargs( *, - client: httpx.Client, - json_body: AddGroupUserRequest, + body: AddGroupUserRequest, ) -> Dict[str, Any]: - url = "{}/v1/groups:addUser".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - json_json_body = json_body.to_dict() + headers: Dict[str, Any] = {} - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/groups:addUser", } + _body = body.to_dict() -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,25 +49,28 @@ def _build_response(*, response: httpx.Response) -> Response[Any]: def sync( *, client: httpx.Client, - json_body: AddGroupUserRequest, + body: AddGroupUserRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Add user to a group Add a user to a group. Note, group membership may take several minutes to update within our identity provider. After adding a user to a group, please allow up to 60 minutes for changes to be reflected. Args: - json_body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` - or `groupName`. + body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` or + `groupName`. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -85,20 +84,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AddGroupUserRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -106,31 +102,31 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: AddGroupUserRequest, + body: AddGroupUserRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Add user to a group Add a user to a group. Note, group membership may take several minutes to update within our identity provider. After adding a user to a group, please allow up to 60 minutes for changes to be reflected. Args: - json_body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` - or `groupName`. + body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` or + `groupName`. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -138,17 +134,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AddGroupUserRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_group_balance.py b/qcs_api_client/api/account/get_group_balance.py index 01ec7c1..c5a0ca9 100644 --- a/qcs_api_client/api/account/get_group_balance.py +++ b/qcs_api_client/api/account/get_group_balance.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.account_balance import AccountBalance from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.account_balance import AccountBalance + def _get_kwargs( group_name: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/balance".format(client.base_url, groupName=group_name) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/balance".format( + group_name=group_name, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> AccountBalance: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[AccountBalance, Error]: + if response.status_code == HTTPStatus.OK: response_200 = AccountBalance.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[AccountBalance]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[AccountBalance, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,7 +45,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: +) -> Response[Union[AccountBalance, Error]]: """Get Group Balance Retrieve the balance of the requested QCS group account. @@ -61,13 +53,16 @@ def sync( Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[AccountBalance] + Response[Union[AccountBalance, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,8 +78,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: - +) -> Response[Union[AccountBalance, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, @@ -93,7 +87,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -103,7 +96,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: +) -> Response[Union[AccountBalance, Error]]: """Get Group Balance Retrieve the balance of the requested QCS group account. @@ -111,19 +104,19 @@ async def asyncio( Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[AccountBalance] + Response[Union[AccountBalance, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -133,14 +126,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: - +) -> Response[Union[AccountBalance, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_group_billing_customer.py b/qcs_api_client/api/account/get_group_billing_customer.py index 89d465a..0725f04 100644 --- a/qcs_api_client/api/account/get_group_billing_customer.py +++ b/qcs_api_client/api/account/get_group_billing_customer.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.billing_customer import BillingCustomer from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.billing_customer import BillingCustomer + def _get_kwargs( group_name: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/billingCustomer".format(client.base_url, groupName=group_name) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/billingCustomer".format( + group_name=group_name, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> BillingCustomer: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[BillingCustomer, Error]: + if response.status_code == HTTPStatus.OK: response_200 = BillingCustomer.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[BillingCustomer]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[BillingCustomer, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,19 +45,22 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: +) -> Response[Union[BillingCustomer, Error]]: """Retrieve billing customer for a QCS group account. Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingCustomer] + Response[Union[BillingCustomer, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -81,8 +76,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: - +) -> Response[Union[BillingCustomer, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, @@ -91,7 +85,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,25 +94,25 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: +) -> Response[Union[BillingCustomer, Error]]: """Retrieve billing customer for a QCS group account. Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingCustomer] + Response[Union[BillingCustomer, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -129,14 +122,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: - +) -> Response[Union[BillingCustomer, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_group_upcoming_billing_invoice.py b/qcs_api_client/api/account/get_group_upcoming_billing_invoice.py index 1e1b31a..3007aa1 100644 --- a/qcs_api_client/api/account/get_group_upcoming_billing_invoice.py +++ b/qcs_api_client/api/account/get_group_upcoming_billing_invoice.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.billing_upcoming_invoice import BillingUpcomingInvoice from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.billing_upcoming_invoice import BillingUpcomingInvoice +from ...models.error import Error + def _get_kwargs( group_name: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/billingInvoices:getUpcoming".format(client.base_url, groupName=group_name) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/billingInvoices:getUpcoming".format( + group_name=group_name, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> BillingUpcomingInvoice: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[BillingUpcomingInvoice, Error]: + if response.status_code == HTTPStatus.OK: response_200 = BillingUpcomingInvoice.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[BillingUpcomingInvoice]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[BillingUpcomingInvoice, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,19 +45,22 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: +) -> Response[Union[BillingUpcomingInvoice, Error]]: """Retrieve upcoming invoice for QCS group billing customer. Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingUpcomingInvoice] + Response[Union[BillingUpcomingInvoice, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -81,8 +76,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: - +) -> Response[Union[BillingUpcomingInvoice, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, @@ -91,7 +85,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,25 +94,25 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: +) -> Response[Union[BillingUpcomingInvoice, Error]]: """Retrieve upcoming invoice for QCS group billing customer. Args: group_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingUpcomingInvoice] + Response[Union[BillingUpcomingInvoice, Error]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -129,14 +122,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: - +) -> Response[Union[BillingUpcomingInvoice, Error]]: kwargs = _get_kwargs( group_name=group_name, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_user_balance.py b/qcs_api_client/api/account/get_user_balance.py index af85162..dd0cfcd 100644 --- a/qcs_api_client/api/account/get_user_balance.py +++ b/qcs_api_client/api/account/get_user_balance.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.account_balance import AccountBalance from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.account_balance import AccountBalance + def _get_kwargs( user_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/balance".format(client.base_url, userId=user_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/balance".format( + user_id=user_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> AccountBalance: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[AccountBalance, Error]: + if response.status_code == HTTPStatus.OK: response_200 = AccountBalance.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[AccountBalance]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[AccountBalance, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,7 +45,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: +) -> Response[Union[AccountBalance, Error]]: """Get User Balance Retrieve the balance of the requested QCS user account. @@ -61,13 +53,16 @@ def sync( Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[AccountBalance] + Response[Union[AccountBalance, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,8 +78,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: - +) -> Response[Union[AccountBalance, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, @@ -93,7 +87,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -103,7 +96,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: +) -> Response[Union[AccountBalance, Error]]: """Get User Balance Retrieve the balance of the requested QCS user account. @@ -111,19 +104,19 @@ async def asyncio( Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[AccountBalance] + Response[Union[AccountBalance, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -133,14 +126,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[AccountBalance]: - +) -> Response[Union[AccountBalance, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_user_billing_customer.py b/qcs_api_client/api/account/get_user_billing_customer.py index bc71041..c71b70b 100644 --- a/qcs_api_client/api/account/get_user_billing_customer.py +++ b/qcs_api_client/api/account/get_user_billing_customer.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.billing_customer import BillingCustomer from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.billing_customer import BillingCustomer + def _get_kwargs( user_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/billingCustomer".format(client.base_url, userId=user_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/billingCustomer".format( + user_id=user_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> BillingCustomer: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[BillingCustomer, Error]: + if response.status_code == HTTPStatus.OK: response_200 = BillingCustomer.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[BillingCustomer]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[BillingCustomer, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,19 +45,22 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: +) -> Response[Union[BillingCustomer, Error]]: """Retrieve billing customer for a QCS user account. Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingCustomer] + Response[Union[BillingCustomer, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -81,8 +76,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: - +) -> Response[Union[BillingCustomer, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, @@ -91,7 +85,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,25 +94,25 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: +) -> Response[Union[BillingCustomer, Error]]: """Retrieve billing customer for a QCS user account. Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingCustomer] + Response[Union[BillingCustomer, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -129,14 +122,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingCustomer]: - +) -> Response[Union[BillingCustomer, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/get_user_upcoming_billing_invoice.py b/qcs_api_client/api/account/get_user_upcoming_billing_invoice.py index 06155c2..08a2233 100644 --- a/qcs_api_client/api/account/get_user_upcoming_billing_invoice.py +++ b/qcs_api_client/api/account/get_user_upcoming_billing_invoice.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.billing_upcoming_invoice import BillingUpcomingInvoice from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.billing_upcoming_invoice import BillingUpcomingInvoice +from ...models.error import Error + def _get_kwargs( user_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/billingInvoices:getUpcoming".format(client.base_url, userId=user_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/billingInvoices:getUpcoming".format( + user_id=user_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> BillingUpcomingInvoice: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[BillingUpcomingInvoice, Error]: + if response.status_code == HTTPStatus.OK: response_200 = BillingUpcomingInvoice.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[BillingUpcomingInvoice]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[BillingUpcomingInvoice, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,19 +45,22 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: +) -> Response[Union[BillingUpcomingInvoice, Error]]: """Retrieve upcoming invoice for QCS user billing customer. Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingUpcomingInvoice] + Response[Union[BillingUpcomingInvoice, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -81,8 +76,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: - +) -> Response[Union[BillingUpcomingInvoice, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, @@ -91,7 +85,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,25 +94,25 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: +) -> Response[Union[BillingUpcomingInvoice, Error]]: """Retrieve upcoming invoice for QCS user billing customer. Args: user_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[BillingUpcomingInvoice] + Response[Union[BillingUpcomingInvoice, Error]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -129,14 +122,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[BillingUpcomingInvoice]: - +) -> Response[Union[BillingUpcomingInvoice, Error]]: kwargs = _get_kwargs( user_id=user_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_group_billing_invoice_lines.py b/qcs_api_client/api/account/list_group_billing_invoice_lines.py index 5d43ab0..f0c42ad 100644 --- a/qcs_api_client/api/account/list_group_billing_invoice_lines.py +++ b/qcs_api_client/api/account/list_group_billing_invoice_lines.py @@ -1,52 +1,58 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoice_lines_response import ListAccountBillingInvoiceLinesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoice_lines_response import ( + ListAccountBillingInvoiceLinesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( group_name: str, billing_invoice_id: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/billingInvoices/{billingInvoiceId}/lines".format( - client.base_url, groupName=group_name, billingInvoiceId=billing_invoice_id - ) + params: Dict[str, Any] = {} - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageToken"] = page_token - return { + params["pageSize"] = page_size + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/billingInvoices/{billing_invoice_id}/lines".format( + group_name=group_name, + billing_invoice_id=billing_invoice_id, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoiceLinesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoiceLinesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoiceLinesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoiceLinesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -56,22 +62,31 @@ def sync( billing_invoice_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """Retrieve billing invoice lines for a QCS group account's invoice. Args: group_name (str): billing_invoice_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( group_name=group_name, billing_invoice_id=billing_invoice_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -87,19 +102,21 @@ def sync_from_dict( billing_invoice_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( group_name=group_name, billing_invoice_id=billing_invoice_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -109,28 +126,34 @@ async def asyncio( billing_invoice_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """Retrieve billing invoice lines for a QCS group account's invoice. Args: group_name (str): billing_invoice_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( group_name=group_name, billing_invoice_id=billing_invoice_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -140,16 +163,19 @@ async def asyncio_from_dict( billing_invoice_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( group_name=group_name, billing_invoice_id=billing_invoice_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_group_billing_invoices.py b/qcs_api_client/api/account/list_group_billing_invoices.py index 6f8925a..d574e1b 100644 --- a/qcs_api_client/api/account/list_group_billing_invoices.py +++ b/qcs_api_client/api/account/list_group_billing_invoices.py @@ -1,49 +1,56 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoices_response import ListAccountBillingInvoicesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoices_response import ( + ListAccountBillingInvoicesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( group_name: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/billingInvoices".format(client.base_url, groupName=group_name) + params: Dict[str, Any] = {} + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size - return { + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/billingInvoices".format( + group_name=group_name, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoicesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoicesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoicesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoicesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,20 +59,29 @@ def sync( group_name: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: """Retrieve billing invoices for a QCS group account. Args: group_name (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoicesResponse] + Response[Union[Error, ListAccountBillingInvoicesResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -80,18 +96,20 @@ def sync_from_dict( group_name: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -100,26 +118,32 @@ async def asyncio( group_name: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: """Retrieve billing invoices for a QCS group account. Args: group_name (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoicesResponse] + Response[Union[Error, ListAccountBillingInvoicesResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -128,15 +152,18 @@ async def asyncio_from_dict( group_name: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_group_upcoming_billing_invoice_lines.py b/qcs_api_client/api/account/list_group_upcoming_billing_invoice_lines.py index 6bc75d9..837851d 100644 --- a/qcs_api_client/api/account/list_group_upcoming_billing_invoice_lines.py +++ b/qcs_api_client/api/account/list_group_upcoming_billing_invoice_lines.py @@ -1,49 +1,56 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoice_lines_response import ListAccountBillingInvoiceLinesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoice_lines_response import ( + ListAccountBillingInvoiceLinesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( group_name: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/billingInvoices:listUpcomingLines".format(client.base_url, groupName=group_name) + params: Dict[str, Any] = {} + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size - return { + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/billingInvoices:listUpcomingLines".format( + group_name=group_name, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoiceLinesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoiceLinesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoiceLinesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoiceLinesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,20 +59,29 @@ def sync( group_name: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """List invoice lines for QCS group billing customer upcoming invoice. Args: group_name (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -80,18 +96,20 @@ def sync_from_dict( group_name: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -100,26 +118,32 @@ async def asyncio( group_name: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """List invoice lines for QCS group billing customer upcoming invoice. Args: group_name (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -128,15 +152,18 @@ async def asyncio_from_dict( group_name: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_group_users.py b/qcs_api_client/api/account/list_group_users.py index 0d8895b..e85985a 100644 --- a/qcs_api_client/api/account/list_group_users.py +++ b/qcs_api_client/api/account/list_group_users.py @@ -1,49 +1,54 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_group_users_response import ListGroupUsersResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_group_users_response import ListGroupUsersResponse +from ...models.error import Error +from ...types import Unset + def _get_kwargs( group_name: str, *, - client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/users".format(client.base_url, groupName=group_name) + params: Dict[str, Any] = {} + + params["pageSize"] = page_size + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/users".format( + group_name=group_name, + ), + "params": params, } + return _kwargs -def _parse_response(*, response: httpx.Response) -> ListGroupUsersResponse: - raise_for_status(response) - if response.status_code == 200: + +def _parse_response(*, response: httpx.Response) -> Union[Error, ListGroupUsersResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListGroupUsersResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListGroupUsersResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListGroupUsersResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,8 +57,10 @@ def sync( group_name: str, *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupUsersResponse]: +) -> Response[Union[Error, ListGroupUsersResponse]]: """List users belonging to a group List users belonging to a group. Note, group membership may take several minutes to update within @@ -62,14 +69,21 @@ def sync( Args: group_name (str): + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListGroupUsersResponse] + Response[Union[Error, ListGroupUsersResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -84,18 +98,20 @@ def sync_from_dict( group_name: str, *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupUsersResponse]: - +) -> Response[Union[Error, ListGroupUsersResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -104,8 +120,10 @@ async def asyncio( group_name: str, *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupUsersResponse]: +) -> Response[Union[Error, ListGroupUsersResponse]]: """List users belonging to a group List users belonging to a group. Note, group membership may take several minutes to update within @@ -114,20 +132,24 @@ async def asyncio( Args: group_name (str): + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListGroupUsersResponse] + Response[Union[Error, ListGroupUsersResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -136,15 +158,18 @@ async def asyncio_from_dict( group_name: str, *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupUsersResponse]: - +) -> Response[Union[Error, ListGroupUsersResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_user_billing_invoice_lines.py b/qcs_api_client/api/account/list_user_billing_invoice_lines.py index b5ab659..04c23c7 100644 --- a/qcs_api_client/api/account/list_user_billing_invoice_lines.py +++ b/qcs_api_client/api/account/list_user_billing_invoice_lines.py @@ -1,52 +1,58 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoice_lines_response import ListAccountBillingInvoiceLinesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoice_lines_response import ( + ListAccountBillingInvoiceLinesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( user_id: str, billing_invoice_id: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/billingInvoices/{billingInvoiceId}/lines".format( - client.base_url, userId=user_id, billingInvoiceId=billing_invoice_id - ) + params: Dict[str, Any] = {} - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageToken"] = page_token - return { + params["pageSize"] = page_size + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/billingInvoices/{billing_invoice_id}/lines".format( + user_id=user_id, + billing_invoice_id=billing_invoice_id, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoiceLinesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoiceLinesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoiceLinesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoiceLinesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -56,22 +62,31 @@ def sync( billing_invoice_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """Retrieve billing invoice lines for a QCS user account's invoice. Args: user_id (str): billing_invoice_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( user_id=user_id, billing_invoice_id=billing_invoice_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -87,19 +102,21 @@ def sync_from_dict( billing_invoice_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( user_id=user_id, billing_invoice_id=billing_invoice_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -109,28 +126,34 @@ async def asyncio( billing_invoice_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """Retrieve billing invoice lines for a QCS user account's invoice. Args: user_id (str): billing_invoice_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( user_id=user_id, billing_invoice_id=billing_invoice_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -140,16 +163,19 @@ async def asyncio_from_dict( billing_invoice_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( user_id=user_id, billing_invoice_id=billing_invoice_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_user_billing_invoices.py b/qcs_api_client/api/account/list_user_billing_invoices.py index f128526..0e22209 100644 --- a/qcs_api_client/api/account/list_user_billing_invoices.py +++ b/qcs_api_client/api/account/list_user_billing_invoices.py @@ -1,49 +1,56 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoices_response import ListAccountBillingInvoicesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoices_response import ( + ListAccountBillingInvoicesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( user_id: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/billingInvoices".format(client.base_url, userId=user_id) + params: Dict[str, Any] = {} + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size - return { + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/billingInvoices".format( + user_id=user_id, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoicesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoicesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoicesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoicesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,20 +59,29 @@ def sync( user_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: """Retrieve billing invoices for a QCS user account. Args: user_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoicesResponse] + Response[Union[Error, ListAccountBillingInvoicesResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -80,18 +96,20 @@ def sync_from_dict( user_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -100,26 +118,32 @@ async def asyncio( user_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: """Retrieve billing invoices for a QCS user account. Args: user_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoicesResponse] + Response[Union[Error, ListAccountBillingInvoicesResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -128,15 +152,18 @@ async def asyncio_from_dict( user_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoicesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoicesResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_user_groups.py b/qcs_api_client/api/account/list_user_groups.py index 8308ac7..6707490 100644 --- a/qcs_api_client/api/account/list_user_groups.py +++ b/qcs_api_client/api/account/list_user_groups.py @@ -1,49 +1,54 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_groups_response import ListGroupsResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_groups_response import ListGroupsResponse +from ...models.error import Error +from ...types import Unset + def _get_kwargs( user_id: str, *, - client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/groups".format(client.base_url, userId=user_id) + params: Dict[str, Any] = {} + + params["pageSize"] = page_size + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/groups".format( + user_id=user_id, + ), + "params": params, } + return _kwargs -def _parse_response(*, response: httpx.Response) -> ListGroupsResponse: - raise_for_status(response) - if response.status_code == 200: + +def _parse_response(*, response: httpx.Response) -> Union[Error, ListGroupsResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListGroupsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListGroupsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListGroupsResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,22 +57,31 @@ def sync( user_id: str, *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupsResponse]: +) -> Response[Union[Error, ListGroupsResponse]]: """List QCS groups for the requested user List QCS groups for the requested user Args: user_id (str): + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListGroupsResponse] + Response[Union[Error, ListGroupsResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -82,18 +96,20 @@ def sync_from_dict( user_id: str, *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupsResponse]: - +) -> Response[Union[Error, ListGroupsResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -102,28 +118,34 @@ async def asyncio( user_id: str, *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupsResponse]: +) -> Response[Union[Error, ListGroupsResponse]]: """List QCS groups for the requested user List QCS groups for the requested user Args: user_id (str): + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListGroupsResponse] + Response[Union[Error, ListGroupsResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -132,15 +154,18 @@ async def asyncio_from_dict( user_id: str, *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListGroupsResponse]: - +) -> Response[Union[Error, ListGroupsResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_size=page_size, + page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/list_user_upcoming_billing_invoice_lines.py b/qcs_api_client/api/account/list_user_upcoming_billing_invoice_lines.py index 33e90d4..561f461 100644 --- a/qcs_api_client/api/account/list_user_upcoming_billing_invoice_lines.py +++ b/qcs_api_client/api/account/list_user_upcoming_billing_invoice_lines.py @@ -1,49 +1,56 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_account_billing_invoice_lines_response import ListAccountBillingInvoiceLinesResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_account_billing_invoice_lines_response import ( + ListAccountBillingInvoiceLinesResponse, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( user_id: str, *, - client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/users/{userId}/billingInvoices:listUpcomingLines".format(client.base_url, userId=user_id) + params: Dict[str, Any] = {} + + params["pageToken"] = page_token - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size - return { + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/users/{user_id}/billingInvoices:listUpcomingLines".format( + user_id=user_id, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListAccountBillingInvoiceLinesResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListAccountBillingInvoiceLinesResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListAccountBillingInvoiceLinesResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListAccountBillingInvoiceLinesResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,20 +59,29 @@ def sync( user_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """List invoice lines for QCS user billing customer upcoming invoice. Args: user_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -80,18 +96,20 @@ def sync_from_dict( user_id: str, *, client: httpx.Client, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -100,26 +118,32 @@ async def asyncio( user_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: """List invoice lines for QCS user billing customer upcoming invoice. Args: user_id (str): + page_token (Union[Unset, str]): + page_size (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListAccountBillingInvoiceLinesResponse] + Response[Union[Error, ListAccountBillingInvoiceLinesResponse]] """ kwargs = _get_kwargs( user_id=user_id, - client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -128,15 +152,18 @@ async def asyncio_from_dict( user_id: str, *, client: httpx.AsyncClient, + page_token: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListAccountBillingInvoiceLinesResponse]: - +) -> Response[Union[Error, ListAccountBillingInvoiceLinesResponse]]: kwargs = _get_kwargs( user_id=user_id, client=client, + page_token=page_token, + page_size=page_size, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/account/remove_group_user.py b/qcs_api_client/api/account/remove_group_user.py index b99e45d..e05ba3b 100644 --- a/qcs_api_client/api/account/remove_group_user.py +++ b/qcs_api_client/api/account/remove_group_user.py @@ -1,51 +1,47 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.remove_group_user_request import RemoveGroupUserRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.remove_group_user_request import RemoveGroupUserRequest +from ...models.error import Error + def _get_kwargs( *, - client: httpx.Client, - json_body: RemoveGroupUserRequest, + body: RemoveGroupUserRequest, ) -> Dict[str, Any]: - url = "{}/v1/groups:removeUser".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - json_json_body = json_body.to_dict() + headers: Dict[str, Any] = {} - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/groups:removeUser", } + _body = body.to_dict() -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,9 +49,9 @@ def _build_response(*, response: httpx.Response) -> Response[Any]: def sync( *, client: httpx.Client, - json_body: RemoveGroupUserRequest, + body: RemoveGroupUserRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Remove user from a group. Remove a user from a group. Note, group membership may take several minutes to update within our @@ -63,16 +59,19 @@ def sync( be reflected. Args: - json_body (RemoveGroupUserRequest): Must provide either `userId` or `userEmail` and - `groupId` or `groupName`. + body (RemoveGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` + or `groupName`. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -86,20 +85,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = RemoveGroupUserRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -107,9 +103,9 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: RemoveGroupUserRequest, + body: RemoveGroupUserRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Remove user from a group. Remove a user from a group. Note, group membership may take several minutes to update within our @@ -117,22 +113,22 @@ async def asyncio( be reflected. Args: - json_body (RemoveGroupUserRequest): Must provide either `userId` or `userEmail` and - `groupId` or `groupName`. + body (RemoveGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` + or `groupName`. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -140,17 +136,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = RemoveGroupUserRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/authentication/auth_email_password_reset_token.py b/qcs_api_client/api/authentication/auth_email_password_reset_token.py index df8f768..41f9d14 100644 --- a/qcs_api_client/api/authentication/auth_email_password_reset_token.py +++ b/qcs_api_client/api/authentication/auth_email_password_reset_token.py @@ -1,51 +1,49 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.auth_email_password_reset_token_request import AuthEmailPasswordResetTokenRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.auth_email_password_reset_token_request import ( + AuthEmailPasswordResetTokenRequest, +) + def _get_kwargs( *, - client: httpx.Client, - json_body: AuthEmailPasswordResetTokenRequest, + body: AuthEmailPasswordResetTokenRequest, ) -> Dict[str, Any]: - url = "{}/v1/auth:emailPasswordResetToken".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} - json_json_body = json_body.to_dict() - - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/auth:emailPasswordResetToken", } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,23 +51,26 @@ def _build_response(*, response: httpx.Response) -> Response[Any]: def sync( *, client: httpx.Client, - json_body: AuthEmailPasswordResetTokenRequest, + body: AuthEmailPasswordResetTokenRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Email Password Reset Token Send a password reset link to the provided email address, if that email matches a registered user. Args: - json_body (AuthEmailPasswordResetTokenRequest): + body (AuthEmailPasswordResetTokenRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,20 +84,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthEmailPasswordResetTokenRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -104,29 +102,29 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: AuthEmailPasswordResetTokenRequest, + body: AuthEmailPasswordResetTokenRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Email Password Reset Token Send a password reset link to the provided email address, if that email matches a registered user. Args: - json_body (AuthEmailPasswordResetTokenRequest): + body (AuthEmailPasswordResetTokenRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -134,17 +132,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthEmailPasswordResetTokenRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/authentication/auth_get_user.py b/qcs_api_client/api/authentication/auth_get_user.py index 2cf94d1..d7d6912 100644 --- a/qcs_api_client/api/authentication/auth_get_user.py +++ b/qcs_api_client/api/authentication/auth_get_user.py @@ -1,48 +1,37 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.user import User from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.user import User +from ...models.error import Error -def _get_kwargs( - *, - client: httpx.Client, -) -> Dict[str, Any]: - url = "{}/v1/auth:getUser".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - return { +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/auth:getUser", } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> User: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, User]: + if response.status_code == HTTPStatus.OK: response_200 = User.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[User]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, User]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -51,18 +40,20 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[User]: +) -> Response[Union[Error, User]]: """Get User Retrieve the profile of the authenticated user. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[User] + Response[Union[Error, User]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, @@ -76,8 +67,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[User]: - +) -> Response[Union[Error, User]]: kwargs = _get_kwargs( client=client, ) @@ -85,7 +75,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -94,23 +83,22 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[User]: +) -> Response[Union[Error, User]]: """Get User Retrieve the profile of the authenticated user. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[User] + Response[Union[Error, User]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -119,13 +107,12 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[User]: - +) -> Response[Union[Error, User]]: kwargs = _get_kwargs( client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/authentication/auth_reset_password.py b/qcs_api_client/api/authentication/auth_reset_password.py index 32b2793..f7ba56b 100644 --- a/qcs_api_client/api/authentication/auth_reset_password.py +++ b/qcs_api_client/api/authentication/auth_reset_password.py @@ -1,51 +1,47 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.auth_reset_password_request import AuthResetPasswordRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.auth_reset_password_request import AuthResetPasswordRequest + def _get_kwargs( *, - client: httpx.Client, - json_body: AuthResetPasswordRequest, + body: AuthResetPasswordRequest, ) -> Dict[str, Any]: - url = "{}/v1/auth:resetPassword".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - json_json_body = json_body.to_dict() + headers: Dict[str, Any] = {} - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/auth:resetPassword", } + _body = body.to_dict() -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,23 +49,26 @@ def _build_response(*, response: httpx.Response) -> Response[Any]: def sync( *, client: httpx.Client, - json_body: AuthResetPasswordRequest, + body: AuthResetPasswordRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Reset Password Reset the password using the user's existing password. Note, this is an authenticated route. Args: - json_body (AuthResetPasswordRequest): + body (AuthResetPasswordRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,20 +82,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthResetPasswordRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -104,29 +100,29 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: AuthResetPasswordRequest, + body: AuthResetPasswordRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Reset Password Reset the password using the user's existing password. Note, this is an authenticated route. Args: - json_body (AuthResetPasswordRequest): + body (AuthResetPasswordRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -134,17 +130,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthResetPasswordRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/authentication/auth_reset_password_with_token.py b/qcs_api_client/api/authentication/auth_reset_password_with_token.py index 3cd6f68..c0bf8fb 100644 --- a/qcs_api_client/api/authentication/auth_reset_password_with_token.py +++ b/qcs_api_client/api/authentication/auth_reset_password_with_token.py @@ -1,51 +1,49 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.auth_reset_password_with_token_request import AuthResetPasswordWithTokenRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.auth_reset_password_with_token_request import ( + AuthResetPasswordWithTokenRequest, +) + def _get_kwargs( *, - client: httpx.Client, - json_body: AuthResetPasswordWithTokenRequest, + body: AuthResetPasswordWithTokenRequest, ) -> Dict[str, Any]: - url = "{}/v1/auth:resetPasswordWithToken".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} - json_json_body = json_body.to_dict() - - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/auth:resetPasswordWithToken", } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,24 +51,27 @@ def _build_response(*, response: httpx.Response) -> Response[Any]: def sync( *, client: httpx.Client, - json_body: AuthResetPasswordWithTokenRequest, + body: AuthResetPasswordWithTokenRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Reset Password With Token Complete the forgot password flow, resetting the new password in exchange for an emailed token. Args: - json_body (AuthResetPasswordWithTokenRequest): Token may be requested with + body (AuthResetPasswordWithTokenRequest): Token may be requested with AuthEmailPasswordResetToken. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -84,20 +85,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthResetPasswordWithTokenRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -105,30 +103,30 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: AuthResetPasswordWithTokenRequest, + body: AuthResetPasswordWithTokenRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error]]: """Reset Password With Token Complete the forgot password flow, resetting the new password in exchange for an emailed token. Args: - json_body (AuthResetPasswordWithTokenRequest): Token may be requested with + body (AuthResetPasswordWithTokenRequest): Token may be requested with AuthEmailPasswordResetToken. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -136,17 +134,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = AuthResetPasswordWithTokenRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/client_applications/check_client_application.py b/qcs_api_client/api/client_applications/check_client_application.py index d4662c8..c04e331 100644 --- a/qcs_api_client/api/client_applications/check_client_application.py +++ b/qcs_api_client/api/client_applications/check_client_application.py @@ -1,53 +1,49 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.check_client_application_request import CheckClientApplicationRequest -from ...models.check_client_application_response import CheckClientApplicationResponse from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.check_client_application_request import CheckClientApplicationRequest +from ...models.error import Error +from ...models.check_client_application_response import CheckClientApplicationResponse + def _get_kwargs( *, - client: httpx.Client, - json_body: CheckClientApplicationRequest, + body: CheckClientApplicationRequest, ) -> Dict[str, Any]: - url = "{}/v1/clientApplications:check".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} - json_json_body = json_body.to_dict() - - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/clientApplications:check", } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs -def _parse_response(*, response: httpx.Response) -> CheckClientApplicationResponse: - raise_for_status(response) - if response.status_code == 200: + +def _parse_response(*, response: httpx.Response) -> Union[CheckClientApplicationResponse, Error]: + if response.status_code == HTTPStatus.OK: response_200 = CheckClientApplicationResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[CheckClientApplicationResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[CheckClientApplicationResponse, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,23 +51,26 @@ def _build_response(*, response: httpx.Response) -> Response[CheckClientApplicat def sync( *, client: httpx.Client, - json_body: CheckClientApplicationRequest, + body: CheckClientApplicationRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[CheckClientApplicationResponse]: +) -> Response[Union[CheckClientApplicationResponse, Error]]: """Check Client Application Check the requested client application version against the latest and minimum version. Args: - json_body (CheckClientApplicationRequest): + body (CheckClientApplicationRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CheckClientApplicationResponse] + Response[Union[CheckClientApplicationResponse, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -85,20 +84,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[CheckClientApplicationResponse]: - json_body = CheckClientApplicationRequest.from_dict(json_body_dict) - +) -> Response[Union[CheckClientApplicationResponse, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -106,29 +102,29 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: CheckClientApplicationRequest, + body: CheckClientApplicationRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[CheckClientApplicationResponse]: +) -> Response[Union[CheckClientApplicationResponse, Error]]: """Check Client Application Check the requested client application version against the latest and minimum version. Args: - json_body (CheckClientApplicationRequest): + body (CheckClientApplicationRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[CheckClientApplicationResponse] + Response[Union[CheckClientApplicationResponse, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -136,17 +132,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[CheckClientApplicationResponse]: - json_body = CheckClientApplicationRequest.from_dict(json_body_dict) - +) -> Response[Union[CheckClientApplicationResponse, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/client_applications/get_client_application.py b/qcs_api_client/api/client_applications/get_client_application.py index a42b1da..1779d81 100644 --- a/qcs_api_client/api/client_applications/get_client_application.py +++ b/qcs_api_client/api/client_applications/get_client_application.py @@ -1,51 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.client_application import ClientApplication from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.client_application import ClientApplication + def _get_kwargs( client_application_name: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/clientApplications/{clientApplicationName}".format( - client.base_url, clientApplicationName=client_application_name - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/clientApplications/{client_application_name}".format( + client_application_name=client_application_name, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ClientApplication: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[ClientApplication, Error]: + if response.status_code == HTTPStatus.OK: response_200 = ClientApplication.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ClientApplication]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[ClientApplication, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,7 +45,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ClientApplication]: +) -> Response[Union[ClientApplication, Error]]: """Get Client Application Get details of a specific Rigetti system component along with its latest and minimum supported @@ -64,13 +54,16 @@ def sync( Args: client_application_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[ClientApplication] + Response[Union[ClientApplication, Error]] """ kwargs = _get_kwargs( client_application_name=client_application_name, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -86,8 +79,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ClientApplication]: - +) -> Response[Union[ClientApplication, Error]]: kwargs = _get_kwargs( client_application_name=client_application_name, client=client, @@ -96,7 +88,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -106,7 +97,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ClientApplication]: +) -> Response[Union[ClientApplication, Error]]: """Get Client Application Get details of a specific Rigetti system component along with its latest and minimum supported @@ -115,19 +106,19 @@ async def asyncio( Args: client_application_name (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[ClientApplication] + Response[Union[ClientApplication, Error]] """ kwargs = _get_kwargs( client_application_name=client_application_name, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -137,14 +128,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ClientApplication]: - +) -> Response[Union[ClientApplication, Error]]: kwargs = _get_kwargs( client_application_name=client_application_name, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/client_applications/list_client_applications.py b/qcs_api_client/api/client_applications/list_client_applications.py index e1edcb0..732a921 100644 --- a/qcs_api_client/api/client_applications/list_client_applications.py +++ b/qcs_api_client/api/client_applications/list_client_applications.py @@ -1,48 +1,36 @@ +from http import HTTPStatus from typing import Any, Dict import httpx from retrying import retry -from ...models.list_client_applications_response import ListClientApplicationsResponse from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_client_applications_response import ListClientApplicationsResponse -def _get_kwargs( - *, - client: httpx.Client, -) -> Dict[str, Any]: - url = "{}/v1/clientApplications".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - return { +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/clientApplications", } + return _kwargs + def _parse_response(*, response: httpx.Response) -> ListClientApplicationsResponse: - raise_for_status(response) - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = ListClientApplicationsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") def _build_response(*, response: httpx.Response) -> Response[ListClientApplicationsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -57,13 +45,15 @@ def sync( List supported clients of Rigetti system components along with their latest and minimum supported versions. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: Response[ListClientApplicationsResponse] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, @@ -78,7 +68,6 @@ def sync_from_dict( client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, ) -> Response[ListClientApplicationsResponse]: - kwargs = _get_kwargs( client=client, ) @@ -86,7 +75,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,18 +89,17 @@ async def asyncio( List supported clients of Rigetti system components along with their latest and minimum supported versions. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: Response[ListClientApplicationsResponse] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -122,12 +109,11 @@ async def asyncio_from_dict( client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, ) -> Response[ListClientApplicationsResponse]: - kwargs = _get_kwargs( client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/default/get_health.py b/qcs_api_client/api/default/get_health.py index 8d050c1..1bf6379 100644 --- a/qcs_api_client/api/default/get_health.py +++ b/qcs_api_client/api/default/get_health.py @@ -1,48 +1,36 @@ +from http import HTTPStatus from typing import Any, Dict import httpx from retrying import retry -from ...models.health import Health from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.health import Health -def _get_kwargs( - *, - client: httpx.Client, -) -> Dict[str, Any]: - url = "{}/".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - return { +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/", } + return _kwargs + def _parse_response(*, response: httpx.Response) -> Health: - raise_for_status(response) - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = Health.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") def _build_response(*, response: httpx.Response) -> Response[Health]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -54,13 +42,15 @@ def sync( ) -> Response[Health]: """Retrieve the health status of the API + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: Response[Health] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, @@ -75,7 +65,6 @@ def sync_from_dict( client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, ) -> Response[Health]: - kwargs = _get_kwargs( client=client, ) @@ -83,7 +72,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -95,18 +83,17 @@ async def asyncio( ) -> Response[Health]: """Retrieve the health status of the API + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: Response[Health] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -116,12 +103,11 @@ async def asyncio_from_dict( client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, ) -> Response[Health]: - kwargs = _get_kwargs( client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/default/health_check.py b/qcs_api_client/api/default/health_check.py index 3b8c40d..976a9a4 100644 --- a/qcs_api_client/api/default/health_check.py +++ b/qcs_api_client/api/default/health_check.py @@ -1,46 +1,35 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError -def _get_kwargs( - *, - client: httpx.Client, -) -> Dict[str, Any]: - url = "{}/v1/healthcheck".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - return { +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/healthcheck", } + return _kwargs -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 200: - response_200 = cast(Any, response.json()) + +def _parse_response(*, response: httpx.Response) -> Union[Any, ValidationError]: + if response.status_code == HTTPStatus.OK: + response_200 = response.json() return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -49,18 +38,20 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, ValidationError]]: """Health Check Endpoint to return a status 200 for load balancer health checks + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, ValidationError]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, @@ -74,8 +65,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, ValidationError]]: kwargs = _get_kwargs( client=client, ) @@ -83,7 +73,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -92,23 +81,22 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, ValidationError]]: """Health Check Endpoint to return a status 200 for load balancer health checks + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, ValidationError]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -117,13 +105,12 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, ValidationError]]: kwargs = _get_kwargs( client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/default/health_check_deprecated.py b/qcs_api_client/api/default/health_check_deprecated.py index 5080bb7..4d92818 100644 --- a/qcs_api_client/api/default/health_check_deprecated.py +++ b/qcs_api_client/api/default/health_check_deprecated.py @@ -1,46 +1,35 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError -def _get_kwargs( - *, - client: httpx.Client, -) -> Dict[str, Any]: - url = "{}/v1/".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - return { +def _get_kwargs() -> Dict[str, Any]: + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/", } + return _kwargs -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 200: - response_200 = cast(Any, response.json()) + +def _parse_response(*, response: httpx.Response) -> Union[Any, ValidationError]: + if response.status_code == HTTPStatus.OK: + response_200 = response.json() return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -49,18 +38,20 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, ValidationError]]: """Health Check Endpoint to return a status 200 for load balancer health checks + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, ValidationError]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, @@ -74,8 +65,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, ValidationError]]: kwargs = _get_kwargs( client=client, ) @@ -83,7 +73,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -92,23 +81,22 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, ValidationError]]: """Health Check Endpoint to return a status 200 for load balancer health checks + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, ValidationError]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -117,13 +105,12 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, ValidationError]]: kwargs = _get_kwargs( client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/create_endpoint.py b/qcs_api_client/api/endpoints/create_endpoint.py index 20aacbc..1c42ec4 100644 --- a/qcs_api_client/api/endpoints/create_endpoint.py +++ b/qcs_api_client/api/endpoints/create_endpoint.py @@ -1,53 +1,50 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.create_endpoint_parameters import CreateEndpointParameters -from ...models.endpoint import Endpoint from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.endpoint import Endpoint +from ...models.create_endpoint_parameters import CreateEndpointParameters +from ...models.error import Error + def _get_kwargs( *, - client: httpx.Client, - json_body: CreateEndpointParameters, + body: CreateEndpointParameters, ) -> Dict[str, Any]: - url = "{}/v1/endpoints".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} - json_json_body = json_body.to_dict() - - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/endpoints", } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs -def _parse_response(*, response: httpx.Response) -> Endpoint: - raise_for_status(response) - if response.status_code == 201: + +def _parse_response(*, response: httpx.Response) -> Union[Endpoint, Error, ValidationError]: + if response.status_code == HTTPStatus.CREATED: response_201 = Endpoint.from_dict(response.json()) return response_201 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Endpoint]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Endpoint, Error, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,24 +52,27 @@ def _build_response(*, response: httpx.Response) -> Response[Endpoint]: def sync( *, client: httpx.Client, - json_body: CreateEndpointParameters, + body: CreateEndpointParameters, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: +) -> Response[Union[Endpoint, Error, ValidationError]]: """Create Endpoint Create an endpoint associated with your user account. Args: - json_body (CreateEndpointParameters): A publicly available set of parameters for defining - an endpoint. + body (CreateEndpointParameters): A publicly available set of parameters for defining an + endpoint. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -86,20 +86,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - json_body = CreateEndpointParameters.from_dict(json_body_dict) - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -107,30 +104,30 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: CreateEndpointParameters, + body: CreateEndpointParameters, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: +) -> Response[Union[Endpoint, Error, ValidationError]]: """Create Endpoint Create an endpoint associated with your user account. Args: - json_body (CreateEndpointParameters): A publicly available set of parameters for defining - an endpoint. + body (CreateEndpointParameters): A publicly available set of parameters for defining an + endpoint. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -138,17 +135,15 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - json_body = CreateEndpointParameters.from_dict(json_body_dict) - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/delete_endpoint.py b/qcs_api_client/api/endpoints/delete_endpoint.py index ef6529c..112ee21 100644 --- a/qcs_api_client/api/endpoints/delete_endpoint.py +++ b/qcs_api_client/api/endpoints/delete_endpoint.py @@ -1,47 +1,40 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.error import Error + def _get_kwargs( endpoint_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/endpoints/{endpointId}".format(client.base_url, endpointId=endpoint_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/endpoints/{endpoint_id}".format( + endpoint_id=endpoint_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: +def _parse_response(*, response: httpx.Response) -> Union[Any, Error, ValidationError]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -51,7 +44,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error, ValidationError]]: """Delete Endpoint Delete an endpoint, releasing its resources. This operation is not reversible. @@ -59,13 +52,16 @@ def sync( Args: endpoint_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -81,8 +77,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, @@ -91,7 +86,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -101,7 +95,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error, ValidationError]]: """Delete Endpoint Delete an endpoint, releasing its resources. This operation is not reversible. @@ -109,19 +103,19 @@ async def asyncio( Args: endpoint_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Any] + Response[Union[Any, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -131,14 +125,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - +) -> Response[Union[Any, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/get_default_endpoint.py b/qcs_api_client/api/endpoints/get_default_endpoint.py index 8fc4fc6..4a5e9d0 100644 --- a/qcs_api_client/api/endpoints/get_default_endpoint.py +++ b/qcs_api_client/api/endpoints/get_default_endpoint.py @@ -1,51 +1,42 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.endpoint import Endpoint from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.endpoint import Endpoint +from ...models.error import Error + def _get_kwargs( quantum_processor_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}/endpoints:getDefault".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors/{quantum_processor_id}/endpoints:getDefault".format( + quantum_processor_id=quantum_processor_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> Endpoint: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Endpoint, Error, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = Endpoint.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Endpoint]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Endpoint, Error, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,8 +46,8 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - """Get Default Endpoint +) -> Response[Union[Endpoint, Error, ValidationError]]: + r"""Get Default Endpoint Retrieve the endpoint set as \"default\" for the given Quantum Processor. @@ -65,13 +56,16 @@ def sync( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -87,8 +81,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -97,7 +90,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -107,8 +99,8 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - """Get Default Endpoint +) -> Response[Union[Endpoint, Error, ValidationError]]: + r"""Get Default Endpoint Retrieve the endpoint set as \"default\" for the given Quantum Processor. @@ -117,19 +109,19 @@ async def asyncio( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -139,14 +131,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/get_endpoint.py b/qcs_api_client/api/endpoints/get_endpoint.py index f9acec9..4fe72d9 100644 --- a/qcs_api_client/api/endpoints/get_endpoint.py +++ b/qcs_api_client/api/endpoints/get_endpoint.py @@ -1,49 +1,42 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.endpoint import Endpoint from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.endpoint import Endpoint +from ...models.error import Error + def _get_kwargs( endpoint_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/endpoints/{endpointId}".format(client.base_url, endpointId=endpoint_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/endpoints/{endpoint_id}".format( + endpoint_id=endpoint_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> Endpoint: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Endpoint, Error, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = Endpoint.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Endpoint]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Endpoint, Error, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,7 +46,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: +) -> Response[Union[Endpoint, Error, ValidationError]]: """Get Endpoint Retrieve a specific endpoint by its ID. @@ -61,13 +54,16 @@ def sync( Args: endpoint_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,8 +79,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, @@ -93,7 +88,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -103,7 +97,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: +) -> Response[Union[Endpoint, Error, ValidationError]]: """Get Endpoint Retrieve a specific endpoint by its ID. @@ -111,19 +105,19 @@ async def asyncio( Args: endpoint_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Endpoint] + Response[Union[Endpoint, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -133,14 +127,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Endpoint]: - +) -> Response[Union[Endpoint, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/list_endpoints.py b/qcs_api_client/api/endpoints/list_endpoints.py index f847d59..6a1f33e 100644 --- a/qcs_api_client/api/endpoints/list_endpoints.py +++ b/qcs_api_client/api/endpoints/list_endpoints.py @@ -1,27 +1,26 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_endpoints_response import ListEndpointsResponse -from ...types import UNSET, Response, Unset -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.list_endpoints_response import ListEndpointsResponse +from ...types import Unset + def _get_kwargs( *, - client: httpx.Client, - filter_: Union[Unset, None, str] = UNSET, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + filter_: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/endpoints".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - params: Dict[str, Any] = {} + params["filter"] = filter_ params["pageSize"] = page_size @@ -30,32 +29,26 @@ def _get_kwargs( params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/endpoints", "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListEndpointsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[ListEndpointsResponse, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = ListEndpointsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListEndpointsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[ListEndpointsResponse, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -63,27 +56,30 @@ def _build_response(*, response: httpx.Response) -> Response[ListEndpointsRespon def sync( *, client: httpx.Client, - filter_: Union[Unset, None, str] = UNSET, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + filter_: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListEndpointsResponse]: +) -> Response[Union[ListEndpointsResponse, ValidationError]]: """List Endpoints List all endpoints, optionally filtering by attribute. Args: - filter_ (Union[Unset, None, str]): Filtering logic specified using [rule- + filter_ (Union[Unset, str]): Filtering logic specified using [rule- engine](https://zerosteiner.github.io/rule-engine/syntax.html) grammar - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListEndpointsResponse] + Response[Union[ListEndpointsResponse, ValidationError]] """ kwargs = _get_kwargs( - client=client, filter_=filter_, page_size=page_size, page_token=page_token, @@ -100,12 +96,11 @@ def sync( def sync_from_dict( *, client: httpx.Client, - filter_: Union[Unset, None, str] = UNSET, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + filter_: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListEndpointsResponse]: - +) -> Response[Union[ListEndpointsResponse, ValidationError]]: kwargs = _get_kwargs( client=client, filter_=filter_, @@ -116,7 +111,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -124,36 +118,36 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - filter_: Union[Unset, None, str] = UNSET, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + filter_: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListEndpointsResponse]: +) -> Response[Union[ListEndpointsResponse, ValidationError]]: """List Endpoints List all endpoints, optionally filtering by attribute. Args: - filter_ (Union[Unset, None, str]): Filtering logic specified using [rule- + filter_ (Union[Unset, str]): Filtering logic specified using [rule- engine](https://zerosteiner.github.io/rule-engine/syntax.html) grammar - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListEndpointsResponse] + Response[Union[ListEndpointsResponse, ValidationError]] """ kwargs = _get_kwargs( - client=client, filter_=filter_, page_size=page_size, page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -161,12 +155,11 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - filter_: Union[Unset, None, str] = UNSET, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + filter_: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListEndpointsResponse]: - +) -> Response[Union[ListEndpointsResponse, ValidationError]]: kwargs = _get_kwargs( client=client, filter_=filter_, @@ -174,7 +167,7 @@ async def asyncio_from_dict( page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/endpoints/restart_endpoint.py b/qcs_api_client/api/endpoints/restart_endpoint.py index c9d08b5..40d9d5d 100644 --- a/qcs_api_client/api/endpoints/restart_endpoint.py +++ b/qcs_api_client/api/endpoints/restart_endpoint.py @@ -1,52 +1,51 @@ -from typing import Any, Dict, cast +from http import HTTPStatus +from typing import Any, Dict, Union, cast import httpx from retrying import retry -from ...models.restart_endpoint_request import RestartEndpointRequest from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.restart_endpoint_request import RestartEndpointRequest +from ...models.error import Error + def _get_kwargs( endpoint_id: str, *, - client: httpx.Client, - json_body: RestartEndpointRequest, + body: RestartEndpointRequest, ) -> Dict[str, Any]: - url = "{}/v1/endpoints/{endpointId}:restart".format(client.base_url, endpointId=endpoint_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - json_json_body = json_body.to_dict() + headers: Dict[str, Any] = {} - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/endpoints/{endpoint_id}:restart".format( + endpoint_id=endpoint_id, + ), } + _body = body.to_dict() -def _parse_response(*, response: httpx.Response) -> Any: - raise_for_status(response) - if response.status_code == 204: + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Any, Error, ValidationError]: + if response.status_code == HTTPStatus.NO_CONTENT: response_204 = cast(Any, None) return response_204 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Any]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,25 +54,28 @@ def sync( endpoint_id: str, *, client: httpx.Client, - json_body: RestartEndpointRequest, + body: RestartEndpointRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error, ValidationError]]: """Restart Endpoint Restart an entire endpoint or a single component within an endpoint. Args: endpoint_id (str): - json_body (RestartEndpointRequest): + body (RestartEndpointRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -88,21 +90,18 @@ def sync_from_dict( endpoint_id: str, *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = RestartEndpointRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -111,31 +110,31 @@ async def asyncio( endpoint_id: str, *, client: httpx.AsyncClient, - json_body: RestartEndpointRequest, + body: RestartEndpointRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: +) -> Response[Union[Any, Error, ValidationError]]: """Restart Endpoint Restart an entire endpoint or a single component within an endpoint. Args: endpoint_id (str): - json_body (RestartEndpointRequest): + body (RestartEndpointRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any] + Response[Union[Any, Error, ValidationError]] """ kwargs = _get_kwargs( endpoint_id=endpoint_id, - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -144,18 +143,16 @@ async def asyncio_from_dict( endpoint_id: str, *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Any]: - json_body = RestartEndpointRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, Error, ValidationError]]: kwargs = _get_kwargs( endpoint_id=endpoint_id, client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/engagements/create_engagement.py b/qcs_api_client/api/engagements/create_engagement.py index ff3151c..b7f37fb 100644 --- a/qcs_api_client/api/engagements/create_engagement.py +++ b/qcs_api_client/api/engagements/create_engagement.py @@ -1,53 +1,58 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.create_engagement_request import CreateEngagementRequest -from ...models.engagement_with_credentials import EngagementWithCredentials -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.account_type import AccountType +from ...models.engagement_with_credentials import EngagementWithCredentials +from ...models.create_engagement_request import CreateEngagementRequest +from ...models.error import Error +from ...types import Unset + def _get_kwargs( *, - client: httpx.Client, - json_body: CreateEngagementRequest, + body: CreateEngagementRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/engagements".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} + if not isinstance(x_qcs_account_id, Unset): + headers["X-QCS-ACCOUNT-ID"] = x_qcs_account_id - json_json_body = json_body.to_dict() + if not isinstance(x_qcs_account_type, Unset): + headers["X-QCS-ACCOUNT-TYPE"] = str(x_qcs_account_type) - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/engagements", } + _body = body.to_dict() -def _parse_response(*, response: httpx.Response) -> EngagementWithCredentials: - raise_for_status(response) - if response.status_code == 200: + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Any, EngagementWithCredentials, Error]: + if response.status_code == HTTPStatus.OK: response_200 = EngagementWithCredentials.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[EngagementWithCredentials]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Any, EngagementWithCredentials, Error]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,9 +60,11 @@ def _build_response(*, response: httpx.Response) -> Response[EngagementWithCrede def sync( *, client: httpx.Client, - json_body: CreateEngagementRequest, + body: CreateEngagementRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[EngagementWithCredentials]: +) -> Response[Union[Any, EngagementWithCredentials, Error]]: """Create Engagement Create a new engagement using the specified parameters. @@ -68,15 +75,25 @@ def sync( service to select a default endpoint. Ignored if **endpointId** is set. Args: - json_body (CreateEngagementRequest): + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + body (CreateEngagementRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[EngagementWithCredentials] + Response[Union[Any, EngagementWithCredentials, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -90,20 +107,21 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[EngagementWithCredentials]: - json_body = CreateEngagementRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, EngagementWithCredentials, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -111,9 +129,11 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: CreateEngagementRequest, + body: CreateEngagementRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[EngagementWithCredentials]: +) -> Response[Union[Any, EngagementWithCredentials, Error]]: """Create Engagement Create a new engagement using the specified parameters. @@ -124,21 +144,28 @@ async def asyncio( service to select a default endpoint. Ignored if **endpointId** is set. Args: - json_body (CreateEngagementRequest): + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + body (CreateEngagementRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[EngagementWithCredentials] + Response[Union[Any, EngagementWithCredentials, Error]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -146,17 +173,19 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[EngagementWithCredentials]: - json_body = CreateEngagementRequest.from_dict(json_body_dict) - +) -> Response[Union[Any, EngagementWithCredentials, Error]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/quantum_processors/get_instruction_set_architecture.py b/qcs_api_client/api/quantum_processors/get_instruction_set_architecture.py index d285f81..3d321b6 100644 --- a/qcs_api_client/api/quantum_processors/get_instruction_set_architecture.py +++ b/qcs_api_client/api/quantum_processors/get_instruction_set_architecture.py @@ -1,51 +1,42 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.instruction_set_architecture import InstructionSetArchitecture from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.instruction_set_architecture import InstructionSetArchitecture +from ...models.validation_error import ValidationError +from ...models.error import Error + def _get_kwargs( quantum_processor_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}/instructionSetArchitecture".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors/{quantum_processor_id}/instructionSetArchitecture".format( + quantum_processor_id=quantum_processor_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> InstructionSetArchitecture: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, InstructionSetArchitecture, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = InstructionSetArchitecture.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[InstructionSetArchitecture]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, InstructionSetArchitecture, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,7 +46,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[InstructionSetArchitecture]: +) -> Response[Union[Error, InstructionSetArchitecture, ValidationError]]: """Get Instruction Set Architecture Retrieve the Instruction Set Architecture of a QuantumProcessor by ID. @@ -63,13 +54,16 @@ def sync( Args: quantum_processor_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[InstructionSetArchitecture] + Response[Union[Error, InstructionSetArchitecture, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -85,8 +79,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[InstructionSetArchitecture]: - +) -> Response[Union[Error, InstructionSetArchitecture, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -95,7 +88,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -105,7 +97,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[InstructionSetArchitecture]: +) -> Response[Union[Error, InstructionSetArchitecture, ValidationError]]: """Get Instruction Set Architecture Retrieve the Instruction Set Architecture of a QuantumProcessor by ID. @@ -113,19 +105,19 @@ async def asyncio( Args: quantum_processor_id (str): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[InstructionSetArchitecture] + Response[Union[Error, InstructionSetArchitecture, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -135,14 +127,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[InstructionSetArchitecture]: - +) -> Response[Union[Error, InstructionSetArchitecture, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/quantum_processors/get_quantum_processor.py b/qcs_api_client/api/quantum_processors/get_quantum_processor.py index 1f7eeaa..fc784cd 100644 --- a/qcs_api_client/api/quantum_processors/get_quantum_processor.py +++ b/qcs_api_client/api/quantum_processors/get_quantum_processor.py @@ -1,51 +1,42 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.quantum_processor import QuantumProcessor from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.quantum_processor import QuantumProcessor +from ...models.error import Error + def _get_kwargs( quantum_processor_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors/{quantum_processor_id}".format( + quantum_processor_id=quantum_processor_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> QuantumProcessor: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, QuantumProcessor, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = QuantumProcessor.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[QuantumProcessor]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, QuantumProcessor, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,7 +46,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[QuantumProcessor]: +) -> Response[Union[Error, QuantumProcessor, ValidationError]]: """Get Quantum Processor Retrieve a single QuantumProcessor by ID. @@ -63,13 +54,16 @@ def sync( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[QuantumProcessor] + Response[Union[Error, QuantumProcessor, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -85,8 +79,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[QuantumProcessor]: - +) -> Response[Union[Error, QuantumProcessor, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -95,7 +88,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -105,7 +97,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[QuantumProcessor]: +) -> Response[Union[Error, QuantumProcessor, ValidationError]]: """Get Quantum Processor Retrieve a single QuantumProcessor by ID. @@ -113,19 +105,19 @@ async def asyncio( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[QuantumProcessor] + Response[Union[Error, QuantumProcessor, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -135,14 +127,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[QuantumProcessor]: - +) -> Response[Union[Error, QuantumProcessor, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/quantum_processors/list_quantum_processor_accessors.py b/qcs_api_client/api/quantum_processors/list_quantum_processor_accessors.py index 3b44431..af998b1 100644 --- a/qcs_api_client/api/quantum_processors/list_quantum_processor_accessors.py +++ b/qcs_api_client/api/quantum_processors/list_quantum_processor_accessors.py @@ -1,61 +1,58 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_quantum_processor_accessors_response import ListQuantumProcessorAccessorsResponse -from ...types import UNSET, Response, Unset -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.list_quantum_processor_accessors_response import ( + ListQuantumProcessorAccessorsResponse, +) +from ...types import Unset + def _get_kwargs( quantum_processor_id: str, *, - client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}/accessors".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - params: Dict[str, Any] = {} + params["pageSize"] = page_size params["pageToken"] = page_token params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors/{quantum_processor_id}/accessors".format( + quantum_processor_id=quantum_processor_id, + ), "params": params, } + return _kwargs -def _parse_response(*, response: httpx.Response) -> ListQuantumProcessorAccessorsResponse: - raise_for_status(response) - if response.status_code == 200: + +def _parse_response(*, response: httpx.Response) -> Union[ListQuantumProcessorAccessorsResponse, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = ListQuantumProcessorAccessorsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListQuantumProcessorAccessorsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response( + *, response: httpx.Response +) -> Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -64,26 +61,29 @@ def sync( quantum_processor_id: str, *, client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorAccessorsResponse]: +) -> Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]]: """List Quantum Processor Accessors List all means of accessing a QuantumProcessor available to the user. Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListQuantumProcessorAccessorsResponse] + Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, page_size=page_size, page_token=page_token, ) @@ -100,11 +100,10 @@ def sync_from_dict( quantum_processor_id: str, *, client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorAccessorsResponse]: - +) -> Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -115,7 +114,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -124,34 +122,34 @@ async def asyncio( quantum_processor_id: str, *, client: httpx.AsyncClient, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorAccessorsResponse]: +) -> Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]]: """List Quantum Processor Accessors List all means of accessing a QuantumProcessor available to the user. Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListQuantumProcessorAccessorsResponse] + Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, page_size=page_size, page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -160,11 +158,10 @@ async def asyncio_from_dict( quantum_processor_id: str, *, client: httpx.AsyncClient, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorAccessorsResponse]: - +) -> Response[Union[ListQuantumProcessorAccessorsResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -172,7 +169,7 @@ async def asyncio_from_dict( page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/quantum_processors/list_quantum_processors.py b/qcs_api_client/api/quantum_processors/list_quantum_processors.py index dd4a39a..202873a 100644 --- a/qcs_api_client/api/quantum_processors/list_quantum_processors.py +++ b/qcs_api_client/api/quantum_processors/list_quantum_processors.py @@ -1,58 +1,51 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_quantum_processors_response import ListQuantumProcessorsResponse -from ...types import UNSET, Response, Unset -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.validation_error import ValidationError +from ...models.list_quantum_processors_response import ListQuantumProcessorsResponse +from ...types import Unset + def _get_kwargs( *, - client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - params: Dict[str, Any] = {} + params["pageSize"] = page_size params["pageToken"] = page_token params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors", "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListQuantumProcessorsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[ListQuantumProcessorsResponse, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = ListQuantumProcessorsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListQuantumProcessorsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[ListQuantumProcessorsResponse, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -60,24 +53,27 @@ def _build_response(*, response: httpx.Response) -> Response[ListQuantumProcesso def sync( *, client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorsResponse]: +) -> Response[Union[ListQuantumProcessorsResponse, ValidationError]]: """List Quantum Processors List all QuantumProcessors available to the user. Args: - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListQuantumProcessorsResponse] + Response[Union[ListQuantumProcessorsResponse, ValidationError]] """ kwargs = _get_kwargs( - client=client, page_size=page_size, page_token=page_token, ) @@ -93,11 +89,10 @@ def sync( def sync_from_dict( *, client: httpx.Client, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorsResponse]: - +) -> Response[Union[ListQuantumProcessorsResponse, ValidationError]]: kwargs = _get_kwargs( client=client, page_size=page_size, @@ -107,7 +102,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -115,32 +109,32 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorsResponse]: +) -> Response[Union[ListQuantumProcessorsResponse, ValidationError]]: """List Quantum Processors List all QuantumProcessors available to the user. Args: - page_size (Union[Unset, None, int]): Default: 10. - page_token (Union[Unset, None, str]): + page_size (Union[Unset, int]): Default: 10. + page_token (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListQuantumProcessorsResponse] + Response[Union[ListQuantumProcessorsResponse, ValidationError]] """ kwargs = _get_kwargs( - client=client, page_size=page_size, page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -148,18 +142,17 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - page_size: Union[Unset, None, int] = 10, - page_token: Union[Unset, None, str] = UNSET, + page_size: Union[Unset, int] = 10, + page_token: Union[Unset, str] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListQuantumProcessorsResponse]: - +) -> Response[Union[ListQuantumProcessorsResponse, ValidationError]]: kwargs = _get_kwargs( client=client, page_size=page_size, page_token=page_token, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/reservations/create_reservation.py b/qcs_api_client/api/reservations/create_reservation.py index 1109cbd..b1b3bff 100644 --- a/qcs_api_client/api/reservations/create_reservation.py +++ b/qcs_api_client/api/reservations/create_reservation.py @@ -1,53 +1,58 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError +from ...util.retry import DEFAULT_RETRY_ARGUMENTS + from ...models.create_reservation_request import CreateReservationRequest +from ...models.account_type import AccountType from ...models.reservation import Reservation -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status -from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...types import Unset def _get_kwargs( *, - client: httpx.Client, - json_body: CreateReservationRequest, + body: CreateReservationRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/reservations".format(client.base_url) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + headers: Dict[str, Any] = {} + if not isinstance(x_qcs_account_id, Unset): + headers["X-QCS-ACCOUNT-ID"] = x_qcs_account_id - json_json_body = json_body.to_dict() + if not isinstance(x_qcs_account_type, Unset): + headers["X-QCS-ACCOUNT-TYPE"] = str(x_qcs_account_type) - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/reservations", } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" -def _parse_response(*, response: httpx.Response) -> Reservation: - raise_for_status(response) - if response.status_code == 201: + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, response: httpx.Response) -> Union[Error, Reservation]: + if response.status_code == HTTPStatus.CREATED: response_201 = Reservation.from_dict(response.json()) return response_201 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Reservation]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, Reservation]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,10 +60,12 @@ def _build_response(*, response: httpx.Response) -> Response[Reservation]: def sync( *, client: httpx.Client, - json_body: CreateReservationRequest, + body: CreateReservationRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - """Create Reservation +) -> Response[Union[Error, Reservation]]: + r"""Create Reservation Create a new reservation. @@ -70,15 +77,25 @@ def sync( header, or if unset then \"user\" type. Args: - json_body (CreateReservationRequest): + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + body (CreateReservationRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Reservation] + Response[Union[Error, Reservation]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -92,20 +109,21 @@ def sync( def sync_from_dict( *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - json_body = CreateReservationRequest.from_dict(json_body_dict) - +) -> Response[Union[Error, Reservation]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -113,10 +131,12 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, - json_body: CreateReservationRequest, + body: CreateReservationRequest, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - """Create Reservation +) -> Response[Union[Error, Reservation]]: + r"""Create Reservation Create a new reservation. @@ -128,21 +148,28 @@ async def asyncio( header, or if unset then \"user\" type. Args: - json_body (CreateReservationRequest): + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + body (CreateReservationRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Reservation] + Response[Union[Error, Reservation]] """ kwargs = _get_kwargs( - client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -150,17 +177,19 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - json_body = CreateReservationRequest.from_dict(json_body_dict) - +) -> Response[Union[Error, Reservation]]: kwargs = _get_kwargs( client=client, - json_body=json_body, + body=body, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/reservations/delete_reservation.py b/qcs_api_client/api/reservations/delete_reservation.py index 47fad44..e9e1931 100644 --- a/qcs_api_client/api/reservations/delete_reservation.py +++ b/qcs_api_client/api/reservations/delete_reservation.py @@ -1,49 +1,41 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.reservation import Reservation from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.error import Error +from ...models.reservation import Reservation + def _get_kwargs( reservation_id: int, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/reservations/{reservationId}".format(client.base_url, reservationId=reservation_id) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/reservations/{reservation_id}".format( + reservation_id=reservation_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> Reservation: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, Reservation]: + if response.status_code == HTTPStatus.OK: response_200 = Reservation.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[Reservation]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, Reservation]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -53,7 +45,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: +) -> Response[Union[Error, Reservation]]: """Delete Reservation Cancel an existing reservation for the user. @@ -61,13 +53,16 @@ def sync( Args: reservation_id (int): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Reservation] + Response[Union[Error, Reservation]] """ kwargs = _get_kwargs( reservation_id=reservation_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -83,8 +78,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - +) -> Response[Union[Error, Reservation]]: kwargs = _get_kwargs( reservation_id=reservation_id, client=client, @@ -93,7 +87,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -103,7 +96,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: +) -> Response[Union[Error, Reservation]]: """Delete Reservation Cancel an existing reservation for the user. @@ -111,19 +104,19 @@ async def asyncio( Args: reservation_id (int): + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[Reservation] + Response[Union[Error, Reservation]] """ kwargs = _get_kwargs( reservation_id=reservation_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -133,14 +126,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[Reservation]: - +) -> Response[Union[Error, Reservation]]: kwargs = _get_kwargs( reservation_id=reservation_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/reservations/find_available_reservations.py b/qcs_api_client/api/reservations/find_available_reservations.py index 55e626c..c47d208 100644 --- a/qcs_api_client/api/reservations/find_available_reservations.py +++ b/qcs_api_client/api/reservations/find_available_reservations.py @@ -1,29 +1,36 @@ -import datetime -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry from rfc3339 import rfc3339 -from ...models.find_available_reservations_response import FindAvailableReservationsResponse -from ...types import UNSET, Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.find_available_reservations_response import ( + FindAvailableReservationsResponse, +) +import datetime +from ...models.error import Error +from ...types import Unset + def _get_kwargs( *, - client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, quantum_processor_id: str, start_time_from: datetime.datetime, duration: str, ) -> Dict[str, Any]: - url = "{}/v1/reservations:findAvailable".format(client.base_url) + params: Dict[str, Any] = {} - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size + + params["pageToken"] = page_token - params: Dict[str, Any] = {} params["quantumProcessorId"] = quantum_processor_id assert start_time_from.tzinfo is not None, "Datetime must have timezone information" @@ -35,32 +42,26 @@ def _get_kwargs( params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/reservations:findAvailable", "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> FindAvailableReservationsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, FindAvailableReservationsResponse]: + if response.status_code == HTTPStatus.OK: response_200 = FindAvailableReservationsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[FindAvailableReservationsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, FindAvailableReservationsResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -68,27 +69,36 @@ def _build_response(*, response: httpx.Response) -> Response[FindAvailableReserv def sync( *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, quantum_processor_id: str, start_time_from: datetime.datetime, duration: str, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[FindAvailableReservationsResponse]: +) -> Response[Union[Error, FindAvailableReservationsResponse]]: """Find Available Reservations List currently available reservations on the requested Rigetti quantum computer. Args: + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): quantum_processor_id (str): start_time_from (datetime.datetime): duration (str): Formatted as specified for golang https://golang.org/pkg/time/#ParseDuration. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[FindAvailableReservationsResponse] + Response[Union[Error, FindAvailableReservationsResponse]] """ kwargs = _get_kwargs( - client=client, + page_size=page_size, + page_token=page_token, quantum_processor_id=quantum_processor_id, start_time_from=start_time_from, duration=duration, @@ -105,14 +115,17 @@ def sync( def sync_from_dict( *, client: httpx.Client, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, quantum_processor_id: str, start_time_from: datetime.datetime, duration: str, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[FindAvailableReservationsResponse]: - +) -> Response[Union[Error, FindAvailableReservationsResponse]]: kwargs = _get_kwargs( client=client, + page_size=page_size, + page_token=page_token, quantum_processor_id=quantum_processor_id, start_time_from=start_time_from, duration=duration, @@ -121,7 +134,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -129,36 +141,42 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, quantum_processor_id: str, start_time_from: datetime.datetime, duration: str, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[FindAvailableReservationsResponse]: +) -> Response[Union[Error, FindAvailableReservationsResponse]]: """Find Available Reservations List currently available reservations on the requested Rigetti quantum computer. Args: + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): quantum_processor_id (str): start_time_from (datetime.datetime): duration (str): Formatted as specified for golang https://golang.org/pkg/time/#ParseDuration. + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[FindAvailableReservationsResponse] + Response[Union[Error, FindAvailableReservationsResponse]] """ kwargs = _get_kwargs( - client=client, + page_size=page_size, + page_token=page_token, quantum_processor_id=quantum_processor_id, start_time_from=start_time_from, duration=duration, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -166,20 +184,23 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, quantum_processor_id: str, start_time_from: datetime.datetime, duration: str, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[FindAvailableReservationsResponse]: - +) -> Response[Union[Error, FindAvailableReservationsResponse]]: kwargs = _get_kwargs( client=client, + page_size=page_size, + page_token=page_token, quantum_processor_id=quantum_processor_id, start_time_from=start_time_from, duration=duration, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/reservations/list_group_reservations.py b/qcs_api_client/api/reservations/list_group_reservations.py index 6242bcc..97130da 100644 --- a/qcs_api_client/api/reservations/list_group_reservations.py +++ b/qcs_api_client/api/reservations/list_group_reservations.py @@ -1,49 +1,70 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_reservations_response import ListReservationsResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.list_reservations_response import ListReservationsResponse +from ...models.list_group_reservations_show_deleted import ( + ListGroupReservationsShowDeleted, +) +from ...models.error import Error +from ...types import Unset + def _get_kwargs( group_name: str, *, - client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListGroupReservationsShowDeleted] = ListGroupReservationsShowDeleted.FALSE, ) -> Dict[str, Any]: - url = "{}/v1/groups/{groupName}/reservations".format(client.base_url, groupName=group_name) + params: Dict[str, Any] = {} + + params["filter"] = filter_ + + params["order"] = order - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["pageSize"] = page_size - return { + params["pageToken"] = page_token + + json_show_deleted: Union[Unset, str] = UNSET + if not isinstance(show_deleted, Unset): + json_show_deleted = show_deleted.value + + params["showDeleted"] = json_show_deleted + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/groups/{group_name}/reservations".format( + group_name=group_name, + ), + "params": params, } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListReservationsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListReservationsResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListReservationsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListReservationsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListReservationsResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -52,8 +73,13 @@ def sync( group_name: str, *, client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListGroupReservationsShowDeleted] = ListGroupReservationsShowDeleted.FALSE, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: +) -> Response[Union[Error, ListReservationsResponse]]: """List Group Reservations List existing reservations for the requested group. @@ -75,14 +101,54 @@ def sync( Args: group_name (str): + filter_ (Union[Unset, str]): A string conforming to a *limited* set of the filtering + operations described in [Google AIP 160](https://google.aip.dev/160). + + * Expressions are always of the form `{field} {operator} {value}` and may be grouped with + `()` and joined with `AND` or `OR`. + * Fields are specific to the route in question, but are typically a subset of attributes + of the requested resource. + * Operators are limited to `=`, `>`, `>=`, `<`, `<=`, and `!=`. + * Values may take the following forms: + * `true` or `false` for boolean fields + * a number + * a string (include surrounding `"`s), + * a duration string (include surrounding `"`s). Valid time units are "ns", "us" (or + "µs"), "ms", "s", "m", "h". + * a date string (include surrounding `"`s). Should be formatted [RFC3339 + 5.6](https://tools.ietf.org/html/rfc3339#section-5.6). + + For example, `startTime >= "2020-06-24T22:00:00.000Z" OR (duration >= "15m" AND endTime < + "2020-06-24T22:00:00.000Z")`. + order (Union[Unset, str]): A string conforming to order specification described in [Google + AIP 132](https://google.aip.dev/132#ordering). + + * Fields are specific to the route in question, but are typically a subset + of attributes of the requested resource. + * May include a comma separated list of many fields. + * Fields are sorted in *ascending* order unless the field is followed by `DESC`. + + For example, `quantumProcessorId, startTime DESC`. + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + show_deleted (Union[Unset, ListGroupReservationsShowDeleted]): Default: + ListGroupReservationsShowDeleted.FALSE. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListReservationsResponse] + Response[Union[Error, ListReservationsResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -97,18 +163,26 @@ def sync_from_dict( group_name: str, *, client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListGroupReservationsShowDeleted] = ListGroupReservationsShowDeleted.FALSE, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: - +) -> Response[Union[Error, ListReservationsResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -117,8 +191,13 @@ async def asyncio( group_name: str, *, client: httpx.AsyncClient, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListGroupReservationsShowDeleted] = ListGroupReservationsShowDeleted.FALSE, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: +) -> Response[Union[Error, ListReservationsResponse]]: """List Group Reservations List existing reservations for the requested group. @@ -140,20 +219,57 @@ async def asyncio( Args: group_name (str): + filter_ (Union[Unset, str]): A string conforming to a *limited* set of the filtering + operations described in [Google AIP 160](https://google.aip.dev/160). + + * Expressions are always of the form `{field} {operator} {value}` and may be grouped with + `()` and joined with `AND` or `OR`. + * Fields are specific to the route in question, but are typically a subset of attributes + of the requested resource. + * Operators are limited to `=`, `>`, `>=`, `<`, `<=`, and `!=`. + * Values may take the following forms: + * `true` or `false` for boolean fields + * a number + * a string (include surrounding `"`s), + * a duration string (include surrounding `"`s). Valid time units are "ns", "us" (or + "µs"), "ms", "s", "m", "h". + * a date string (include surrounding `"`s). Should be formatted [RFC3339 + 5.6](https://tools.ietf.org/html/rfc3339#section-5.6). + + For example, `startTime >= "2020-06-24T22:00:00.000Z" OR (duration >= "15m" AND endTime < + "2020-06-24T22:00:00.000Z")`. + order (Union[Unset, str]): A string conforming to order specification described in [Google + AIP 132](https://google.aip.dev/132#ordering). + + * Fields are specific to the route in question, but are typically a subset + of attributes of the requested resource. + * May include a comma separated list of many fields. + * Fields are sorted in *ascending* order unless the field is followed by `DESC`. + + For example, `quantumProcessorId, startTime DESC`. + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + show_deleted (Union[Unset, ListGroupReservationsShowDeleted]): Default: + ListGroupReservationsShowDeleted.FALSE. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[ListReservationsResponse] + Response[Union[Error, ListReservationsResponse]] """ kwargs = _get_kwargs( group_name=group_name, - client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -162,15 +278,24 @@ async def asyncio_from_dict( group_name: str, *, client: httpx.AsyncClient, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListGroupReservationsShowDeleted] = ListGroupReservationsShowDeleted.FALSE, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: - +) -> Response[Union[Error, ListReservationsResponse]]: kwargs = _get_kwargs( group_name=group_name, client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/reservations/list_reservations.py b/qcs_api_client/api/reservations/list_reservations.py index 9df86fb..1139a1e 100644 --- a/qcs_api_client/api/reservations/list_reservations.py +++ b/qcs_api_client/api/reservations/list_reservations.py @@ -1,48 +1,76 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.list_reservations_response import ListReservationsResponse -from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...types import Response, UNSET +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...types import Unset +from ...models.list_reservations_response import ListReservationsResponse +from ...models.account_type import AccountType +from ...models.error import Error +from ...models.list_reservations_show_deleted import ListReservationsShowDeleted + def _get_kwargs( *, - client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListReservationsShowDeleted] = ListReservationsShowDeleted.FALSE, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, ) -> Dict[str, Any]: - url = "{}/v1/reservations".format(client.base_url) + headers: Dict[str, Any] = {} + if not isinstance(x_qcs_account_id, Unset): + headers["X-QCS-ACCOUNT-ID"] = x_qcs_account_id + + if not isinstance(x_qcs_account_type, Unset): + headers["X-QCS-ACCOUNT-TYPE"] = str(x_qcs_account_type) + + params: Dict[str, Any] = {} + + params["filter"] = filter_ - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} + params["order"] = order - return { + params["pageSize"] = page_size + + params["pageToken"] = page_token + + json_show_deleted: Union[Unset, str] = UNSET + if not isinstance(show_deleted, Unset): + json_show_deleted = show_deleted.value + + params["showDeleted"] = json_show_deleted + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/reservations", + "params": params, } + _kwargs["headers"] = headers + return _kwargs + -def _parse_response(*, response: httpx.Response) -> ListReservationsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, ListReservationsResponse]: + if response.status_code == HTTPStatus.OK: response_200 = ListReservationsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[ListReservationsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response(*, response: httpx.Response) -> Response[Union[Error, ListReservationsResponse]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -50,8 +78,15 @@ def _build_response(*, response: httpx.Response) -> Response[ListReservationsRes def sync( *, client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListReservationsShowDeleted] = ListReservationsShowDeleted.FALSE, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: +) -> Response[Union[Error, ListReservationsResponse]]: """List Reservations List existing reservations for the authenticated user, @@ -74,12 +109,61 @@ def sync( * `createdTime` - timestamp * `price` - integer + Args: + filter_ (Union[Unset, str]): A string conforming to a *limited* set of the filtering + operations described in [Google AIP 160](https://google.aip.dev/160). + + * Expressions are always of the form `{field} {operator} {value}` and may be grouped with + `()` and joined with `AND` or `OR`. + * Fields are specific to the route in question, but are typically a subset of attributes + of the requested resource. + * Operators are limited to `=`, `>`, `>=`, `<`, `<=`, and `!=`. + * Values may take the following forms: + * `true` or `false` for boolean fields + * a number + * a string (include surrounding `"`s), + * a duration string (include surrounding `"`s). Valid time units are "ns", "us" (or + "µs"), "ms", "s", "m", "h". + * a date string (include surrounding `"`s). Should be formatted [RFC3339 + 5.6](https://tools.ietf.org/html/rfc3339#section-5.6). + + For example, `startTime >= "2020-06-24T22:00:00.000Z" OR (duration >= "15m" AND endTime < + "2020-06-24T22:00:00.000Z")`. + order (Union[Unset, str]): A string conforming to order specification described in [Google + AIP 132](https://google.aip.dev/132#ordering). + + * Fields are specific to the route in question, but are typically a subset + of attributes of the requested resource. + * May include a comma separated list of many fields. + * Fields are sorted in *ascending* order unless the field is followed by `DESC`. + + For example, `quantumProcessorId, startTime DESC`. + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + show_deleted (Union[Unset, ListReservationsShowDeleted]): Default: + ListReservationsShowDeleted.FALSE. + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[ListReservationsResponse] + Response[Union[Error, ListReservationsResponse]] """ kwargs = _get_kwargs( - client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -93,17 +177,29 @@ def sync( def sync_from_dict( *, client: httpx.Client, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListReservationsShowDeleted] = ListReservationsShowDeleted.FALSE, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: - +) -> Response[Union[Error, ListReservationsResponse]]: kwargs = _get_kwargs( client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -111,8 +207,15 @@ def sync_from_dict( async def asyncio( *, client: httpx.AsyncClient, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListReservationsShowDeleted] = ListReservationsShowDeleted.FALSE, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: +) -> Response[Union[Error, ListReservationsResponse]]: """List Reservations List existing reservations for the authenticated user, @@ -135,18 +238,64 @@ async def asyncio( * `createdTime` - timestamp * `price` - integer + Args: + filter_ (Union[Unset, str]): A string conforming to a *limited* set of the filtering + operations described in [Google AIP 160](https://google.aip.dev/160). + + * Expressions are always of the form `{field} {operator} {value}` and may be grouped with + `()` and joined with `AND` or `OR`. + * Fields are specific to the route in question, but are typically a subset of attributes + of the requested resource. + * Operators are limited to `=`, `>`, `>=`, `<`, `<=`, and `!=`. + * Values may take the following forms: + * `true` or `false` for boolean fields + * a number + * a string (include surrounding `"`s), + * a duration string (include surrounding `"`s). Valid time units are "ns", "us" (or + "µs"), "ms", "s", "m", "h". + * a date string (include surrounding `"`s). Should be formatted [RFC3339 + 5.6](https://tools.ietf.org/html/rfc3339#section-5.6). + + For example, `startTime >= "2020-06-24T22:00:00.000Z" OR (duration >= "15m" AND endTime < + "2020-06-24T22:00:00.000Z")`. + order (Union[Unset, str]): A string conforming to order specification described in [Google + AIP 132](https://google.aip.dev/132#ordering). + + * Fields are specific to the route in question, but are typically a subset + of attributes of the requested resource. + * May include a comma separated list of many fields. + * Fields are sorted in *ascending* order unless the field is followed by `DESC`. + + For example, `quantumProcessorId, startTime DESC`. + page_size (Union[Unset, int]): + page_token (Union[Unset, str]): + show_deleted (Union[Unset, ListReservationsShowDeleted]): Default: + ListReservationsShowDeleted.FALSE. + x_qcs_account_id (Union[Unset, str]): userId for `accountType` "user", group name for + `accountType` "group". + x_qcs_account_type (Union[Unset, AccountType]): There are two types of accounts within + QCS: user (representing a single user in Okta) and group + (representing one or more users in Okta). + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[ListReservationsResponse] + Response[Union[Error, ListReservationsResponse]] """ kwargs = _get_kwargs( - client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -154,14 +303,27 @@ async def asyncio( async def asyncio_from_dict( *, client: httpx.AsyncClient, + filter_: Union[Unset, str] = UNSET, + order: Union[Unset, str] = UNSET, + page_size: Union[Unset, int] = UNSET, + page_token: Union[Unset, str] = UNSET, + show_deleted: Union[Unset, ListReservationsShowDeleted] = ListReservationsShowDeleted.FALSE, + x_qcs_account_id: Union[Unset, str] = UNSET, + x_qcs_account_type: Union[Unset, AccountType] = UNSET, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[ListReservationsResponse]: - +) -> Response[Union[Error, ListReservationsResponse]]: kwargs = _get_kwargs( client=client, + filter_=filter_, + order=order, + page_size=page_size, + page_token=page_token, + show_deleted=show_deleted, + x_qcs_account_id=x_qcs_account_id, + x_qcs_account_type=x_qcs_account_type, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/translation/get_quilt_calibrations.py b/qcs_api_client/api/translation/get_quilt_calibrations.py index e255461..9f6da6e 100644 --- a/qcs_api_client/api/translation/get_quilt_calibrations.py +++ b/qcs_api_client/api/translation/get_quilt_calibrations.py @@ -1,51 +1,44 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.get_quilt_calibrations_response import GetQuiltCalibrationsResponse from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.get_quilt_calibrations_response import GetQuiltCalibrationsResponse +from ...models.validation_error import ValidationError +from ...models.error import Error + def _get_kwargs( quantum_processor_id: str, - *, - client: httpx.Client, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}/quiltCalibrations".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) - - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - return { + _kwargs: Dict[str, Any] = { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, + "url": "/v1/quantumProcessors/{quantum_processor_id}/quiltCalibrations".format( + quantum_processor_id=quantum_processor_id, + ), } + return _kwargs + -def _parse_response(*, response: httpx.Response) -> GetQuiltCalibrationsResponse: - raise_for_status(response) - if response.status_code == 200: +def _parse_response(*, response: httpx.Response) -> Union[Error, GetQuiltCalibrationsResponse, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = GetQuiltCalibrationsResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[GetQuiltCalibrationsResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response( + *, response: httpx.Response +) -> Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -55,7 +48,7 @@ def sync( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[GetQuiltCalibrationsResponse]: +) -> Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]]: """Get Quilt Calibrations Retrieve the calibration data used for client-side Quilt generation. @@ -63,13 +56,16 @@ def sync( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[GetQuiltCalibrationsResponse] + Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -85,8 +81,7 @@ def sync_from_dict( *, client: httpx.Client, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[GetQuiltCalibrationsResponse]: - +) -> Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, @@ -95,7 +90,6 @@ def sync_from_dict( response = client.request( **kwargs, ) - return _build_response(response=response) @@ -105,7 +99,7 @@ async def asyncio( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[GetQuiltCalibrationsResponse]: +) -> Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]]: """Get Quilt Calibrations Retrieve the calibration data used for client-side Quilt generation. @@ -113,19 +107,19 @@ async def asyncio( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + Returns: - Response[GetQuiltCalibrationsResponse] + Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -135,14 +129,13 @@ async def asyncio_from_dict( *, client: httpx.AsyncClient, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[GetQuiltCalibrationsResponse]: - +) -> Response[Union[Error, GetQuiltCalibrationsResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/api/translation/translate_native_quil_to_encrypted_binary.py b/qcs_api_client/api/translation/translate_native_quil_to_encrypted_binary.py index a3cb296..a383e0c 100644 --- a/qcs_api_client/api/translation/translate_native_quil_to_encrypted_binary.py +++ b/qcs_api_client/api/translation/translate_native_quil_to_encrypted_binary.py @@ -1,56 +1,61 @@ -from typing import Any, Dict +from http import HTTPStatus +from typing import Any, Dict, Union import httpx from retrying import retry -from ...models.translate_native_quil_to_encrypted_binary_request import TranslateNativeQuilToEncryptedBinaryRequest -from ...models.translate_native_quil_to_encrypted_binary_response import TranslateNativeQuilToEncryptedBinaryResponse from ...types import Response -from ...util.errors import QCSHTTPStatusError, raise_for_status +from ...util.errors import QCSHTTPStatusError from ...util.retry import DEFAULT_RETRY_ARGUMENTS +from ...models.translate_native_quil_to_encrypted_binary_response import ( + TranslateNativeQuilToEncryptedBinaryResponse, +) +from ...models.validation_error import ValidationError +from ...models.translate_native_quil_to_encrypted_binary_request import ( + TranslateNativeQuilToEncryptedBinaryRequest, +) +from ...models.error import Error + def _get_kwargs( quantum_processor_id: str, *, - client: httpx.Client, - json_body: TranslateNativeQuilToEncryptedBinaryRequest, + body: TranslateNativeQuilToEncryptedBinaryRequest, ) -> Dict[str, Any]: - url = "{}/v1/quantumProcessors/{quantumProcessorId}:translateNativeQuilToEncryptedBinary".format( - client.base_url, quantumProcessorId=quantum_processor_id - ) + headers: Dict[str, Any] = {} - headers = {k: v for (k, v) in client.headers.items()} - cookies = {k: v for (k, v) in client.cookies} - - json_json_body = json_body.to_dict() - - return { + _kwargs: Dict[str, Any] = { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.timeout, - "json": json_json_body, + "url": "/v1/quantumProcessors/{quantum_processor_id}:translateNativeQuilToEncryptedBinary".format( + quantum_processor_id=quantum_processor_id, + ), } + _body = body.to_dict() + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" -def _parse_response(*, response: httpx.Response) -> TranslateNativeQuilToEncryptedBinaryResponse: - raise_for_status(response) - if response.status_code == 200: + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, response: httpx.Response +) -> Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]: + if response.status_code == HTTPStatus.OK: response_200 = TranslateNativeQuilToEncryptedBinaryResponse.from_dict(response.json()) return response_200 else: - raise QCSHTTPStatusError( - f"Unexpected response: status code {response.status_code}", response=response, error=None - ) + raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}") -def _build_response(*, response: httpx.Response) -> Response[TranslateNativeQuilToEncryptedBinaryResponse]: - """ - Construct the Response class from the raw ``httpx.Response``. - """ +def _build_response( + *, response: httpx.Response +) -> Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]]: + """Construct the Response class from the raw ``httpx.Response``.""" return Response.build_from_httpx_response(response=response, parse_function=_parse_response) @@ -59,9 +64,9 @@ def sync( quantum_processor_id: str, *, client: httpx.Client, - json_body: TranslateNativeQuilToEncryptedBinaryRequest, + body: TranslateNativeQuilToEncryptedBinaryRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[TranslateNativeQuilToEncryptedBinaryResponse]: +) -> Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]]: """Translate Native Quil To Encrypted Binary Compile Rigetti-native Quil code to encrypted binary form, ready for execution on a @@ -69,16 +74,19 @@ def sync( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] - json_body (TranslateNativeQuilToEncryptedBinaryRequest): + body (TranslateNativeQuilToEncryptedBinaryRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[TranslateNativeQuilToEncryptedBinaryResponse] + Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( @@ -93,21 +101,18 @@ def sync_from_dict( quantum_processor_id: str, *, client: httpx.Client, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[TranslateNativeQuilToEncryptedBinaryResponse]: - json_body = TranslateNativeQuilToEncryptedBinaryRequest.from_dict(json_body_dict) - +) -> Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) response = client.request( **kwargs, ) - return _build_response(response=response) @@ -116,9 +121,9 @@ async def asyncio( quantum_processor_id: str, *, client: httpx.AsyncClient, - json_body: TranslateNativeQuilToEncryptedBinaryRequest, + body: TranslateNativeQuilToEncryptedBinaryRequest, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[TranslateNativeQuilToEncryptedBinaryResponse]: +) -> Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]]: """Translate Native Quil To Encrypted Binary Compile Rigetti-native Quil code to encrypted binary form, ready for execution on a @@ -126,22 +131,22 @@ async def asyncio( Args: quantum_processor_id (str): Public identifier for a quantum processor [example: Aspen-1] - json_body (TranslateNativeQuilToEncryptedBinaryRequest): + body (TranslateNativeQuilToEncryptedBinaryRequest): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[TranslateNativeQuilToEncryptedBinaryResponse] + Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]] """ kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, - client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = await client.request( - **kwargs, - ) - + response = await client.request(**kwargs) return _build_response(response=response) @@ -150,18 +155,16 @@ async def asyncio_from_dict( quantum_processor_id: str, *, client: httpx.AsyncClient, - json_body_dict: Dict, + body: Dict, httpx_request_kwargs: Dict[str, Any] = {}, -) -> Response[TranslateNativeQuilToEncryptedBinaryResponse]: - json_body = TranslateNativeQuilToEncryptedBinaryRequest.from_dict(json_body_dict) - +) -> Response[Union[Error, TranslateNativeQuilToEncryptedBinaryResponse, ValidationError]]: kwargs = _get_kwargs( quantum_processor_id=quantum_processor_id, client=client, - json_body=json_body, + body=body, ) kwargs.update(httpx_request_kwargs) - response = client.request( + response = await client.request( **kwargs, ) diff --git a/qcs_api_client/client/_configuration/environment.py b/qcs_api_client/client/_configuration/environment.py index fbc3f17..249b723 100644 --- a/qcs_api_client/client/_configuration/environment.py +++ b/qcs_api_client/client/_configuration/environment.py @@ -2,7 +2,8 @@ from typing import Any, Dict from pydantic import BaseModel -from pydantic.utils import deep_update +from pydantic.v1.utils import deep_update +from pydantic_settings.sources import _annotation_is_complex class _EnvironmentBaseModel(BaseModel): @@ -19,19 +20,19 @@ def _read_env(self) -> Dict[str, str]: Environment variable name is case insensitive. The prefix is set as ``env_prefix``on the model's ``Config``. """ - if not getattr(self.__config__, "env_prefix", None): + if not self.model_config.get("env_prefix"): return {} data: Dict[str, str] = {} env: Dict[str, str] = {k.lower(): v for k, v in os.environ.items()} - for field in self.__fields__.values(): + for field_name, field in self.model_fields.items(): # We only read primitives from the environment, no JSON parsing - if not field.is_complex(): - env_name = (self.__config__.env_prefix + field.name).lower() + if not _annotation_is_complex(field.annotation, field.metadata): + env_name = (self.model_config["env_prefix"] + field_name).lower() if env_name in env: - data[field.name] = env[env_name] + data[field_name] = env[env_name] return data @@ -53,5 +54,4 @@ def __init__(self, **kwargs: Any) -> None: self._read_env(), kwargs, ) - super().__init__(**values) diff --git a/qcs_api_client/client/_configuration/secrets.py b/qcs_api_client/client/_configuration/secrets.py index 1c17955..4c99946 100644 --- a/qcs_api_client/client/_configuration/secrets.py +++ b/qcs_api_client/client/_configuration/secrets.py @@ -23,12 +23,12 @@ class TokenPayload(BaseModel): token expires. """ - refresh_token: Optional[str] - access_token: Optional[str] - scope: Optional[str] - expires_in: Optional[int] - id_token: Optional[str] - token_type: Optional[str] + refresh_token: Optional[str] = None + access_token: Optional[str] = None + scope: Optional[str] = None + expires_in: Optional[int] = None + id_token: Optional[str] = None + token_type: Optional[str] = None def get_access_token_claims(self, key: Union[None, bytes, str] = None): """Return the claims within the encoded access token. @@ -45,17 +45,17 @@ def get_access_token_claims(self, key: Union[None, bytes, str] = None): def access_token_expires_at(self) -> Optional[datetime]: """Return the datetime that the token expires (if any).""" claims = self.get_access_token_claims() - iat = claims.get("iat") - if iat is None: + exp = claims.get("exp") + if exp is None: return None - return datetime.utcfromtimestamp(int(iat)) + return datetime.utcfromtimestamp(int(exp)).astimezone(timezone.utc) def should_refresh(self) -> bool: """Return True if the token is past or nearing expiration and should be refreshed.""" - iat = self.access_token_expires_at - if iat is None: + exp = self.access_token_expires_at + if exp is None: return False - return iat - _TOKEN_REFRESH_PREEMPT_INTERVAL < datetime.now().astimezone(timezone.utc) + return exp - _TOKEN_REFRESH_PREEMPT_INTERVAL < datetime.now().astimezone(timezone.utc) class QCSClientConfigurationSecretsCredentials(BaseModel): diff --git a/qcs_api_client/client/_configuration/settings.py b/qcs_api_client/client/_configuration/settings.py index 4d75ea9..7645381 100644 --- a/qcs_api_client/client/_configuration/settings.py +++ b/qcs_api_client/client/_configuration/settings.py @@ -3,6 +3,9 @@ from pydantic.fields import Field from pydantic.networks import HttpUrl from enum import Enum + +from pydantic_settings import SettingsConfigDict + from .environment import EnvironmentModel from .file import QCSClientConfigurationFile @@ -23,8 +26,7 @@ def token_url(self): def scopes(): return ["offline_access"] - class Config: - env_prefix = "QCS_SETTINGS_AUTH_SERVER_" + model_config = SettingsConfigDict(env_prefix="QCS_SETTINGS_AUTH_SERVER_") _DEFAULT_AUTH_SERVER = QCSAuthServer( @@ -36,16 +38,14 @@ class Config: class QCSClientConfigurationSettingsApplicationsCLI(EnvironmentModel): verbosity: str = "" - class Config: - env_prefix = "QCS_SETTINGS_APPLICATIONS_CLI_" + model_config = SettingsConfigDict(env_prefix="QCS_SETTINGS_APPLICATIONS_CLI_") class QCSClientConfigurationSettingsApplicationsPyquil(EnvironmentModel): qvm_url: str = "http://127.0.0.1:5000" quilc_url: str = "tcp://127.0.0.1:5555" - class Config: - env_prefix = "QCS_SETTINGS_APPLICATIONS_PYQUIL_" + model_config = SettingsConfigDict(env_prefix="QCS_SETTINGS_APPLICATIONS_PYQUIL_") class QCSClientConfigurationSettingsApplications(BaseModel): @@ -105,8 +105,7 @@ class QCSClientConfigurationSettingsProfile(EnvironmentModel): to a group name, this must be set to ``AccountType.group``. """ - class Config: - env_prefix = "QCS_SETTINGS_" + model_config = SettingsConfigDict(env_prefix="QCS_SETTINGS_") class QCSClientConfigurationSettings(QCSClientConfigurationFile): diff --git a/qcs_api_client/client/client.py b/qcs_api_client/client/client.py index 766873b..8163da1 100644 --- a/qcs_api_client/client/client.py +++ b/qcs_api_client/client/client.py @@ -21,7 +21,7 @@ def _build_client_kwargs( client_configuration=configuration, auth_configuration=auth_configuration, ) - kwargs = dict(auth=auth, base_url=configuration.profile.api_url) + kwargs = dict(auth=auth, base_url=str(configuration.profile.api_url)) if kwarg_overrides is not None: kwargs.update(kwarg_overrides) diff --git a/qcs_api_client/errors.py b/qcs_api_client/errors.py new file mode 100644 index 0000000..5f92e76 --- /dev/null +++ b/qcs_api_client/errors.py @@ -0,0 +1,16 @@ +"""Contains shared errors types that can be raised from API functions""" + + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__( + f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" + ) + + +__all__ = ["UnexpectedStatus"] diff --git a/qcs_api_client/models/__init__.py b/qcs_api_client/models/__init__.py index 3e16e5b..e49b8c3 100644 --- a/qcs_api_client/models/__init__.py +++ b/qcs_api_client/models/__init__.py @@ -1,4 +1,4 @@ -""" Contains all the data models used in inputs/outputs """ +"""Contains all the data models used in inputs/outputs""" from .account_balance import AccountBalance from .account_type import AccountType @@ -18,7 +18,9 @@ from .billing_price_object import BillingPriceObject from .billing_price_price_type import BillingPricePriceType from .billing_price_recurrence import BillingPriceRecurrence -from .billing_price_recurrence_aggregate_usage import BillingPriceRecurrenceAggregateUsage +from .billing_price_recurrence_aggregate_usage import ( + BillingPriceRecurrenceAggregateUsage, +) from .billing_price_recurrence_interval import BillingPriceRecurrenceInterval from .billing_price_recurrence_usage_type import BillingPriceRecurrenceUsageType from .billing_price_scheme import BillingPriceScheme @@ -50,15 +52,21 @@ from .health import Health from .instruction_set_architecture import InstructionSetArchitecture from .invite_user_request import InviteUserRequest -from .list_account_billing_invoice_lines_response import ListAccountBillingInvoiceLinesResponse +from .list_account_billing_invoice_lines_response import ( + ListAccountBillingInvoiceLinesResponse, +) from .list_account_billing_invoices_response import ListAccountBillingInvoicesResponse from .list_client_applications_response import ListClientApplicationsResponse from .list_endpoints_response import ListEndpointsResponse +from .list_group_reservations_show_deleted import ListGroupReservationsShowDeleted from .list_group_users_response import ListGroupUsersResponse from .list_groups_response import ListGroupsResponse -from .list_quantum_processor_accessors_response import ListQuantumProcessorAccessorsResponse +from .list_quantum_processor_accessors_response import ( + ListQuantumProcessorAccessorsResponse, +) from .list_quantum_processors_response import ListQuantumProcessorsResponse from .list_reservations_response import ListReservationsResponse +from .list_reservations_show_deleted import ListReservationsShowDeleted from .node import Node from .nomad_job_datacenters import NomadJobDatacenters from .operation import Operation @@ -72,8 +80,12 @@ from .reservation import Reservation from .restart_endpoint_request import RestartEndpointRequest from .tier import Tier -from .translate_native_quil_to_encrypted_binary_request import TranslateNativeQuilToEncryptedBinaryRequest -from .translate_native_quil_to_encrypted_binary_response import TranslateNativeQuilToEncryptedBinaryResponse +from .translate_native_quil_to_encrypted_binary_request import ( + TranslateNativeQuilToEncryptedBinaryRequest, +) +from .translate_native_quil_to_encrypted_binary_response import ( + TranslateNativeQuilToEncryptedBinaryResponse, +) from .translate_native_quil_to_encrypted_binary_response_memory_descriptors import ( TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors, ) @@ -83,3 +95,89 @@ from .user_profile import UserProfile from .validation_error import ValidationError from .validation_error_in import ValidationErrorIn + +__all__ = ( + "AccountBalance", + "AccountType", + "AddGroupUserRequest", + "Architecture", + "AuthEmailPasswordResetTokenRequest", + "AuthResetPasswordRequest", + "AuthResetPasswordWithTokenRequest", + "AvailableReservation", + "BillingCustomer", + "BillingInvoice", + "BillingInvoiceLine", + "BillingInvoiceLineLineItemType", + "BillingInvoiceLineMetadata", + "BillingInvoiceStatus", + "BillingPrice", + "BillingPriceObject", + "BillingPricePriceType", + "BillingPriceRecurrence", + "BillingPriceRecurrenceAggregateUsage", + "BillingPriceRecurrenceInterval", + "BillingPriceRecurrenceUsageType", + "BillingPriceScheme", + "BillingPriceTiersMode", + "BillingProduct", + "BillingProductObject", + "BillingUpcomingInvoice", + "Characteristic", + "CheckClientApplicationRequest", + "CheckClientApplicationResponse", + "ChecksumDescription", + "ChecksumDescriptionType", + "ClientApplication", + "ClientApplicationsDownloadLink", + "CreateEndpointParameters", + "CreateEngagementRequest", + "CreateReservationRequest", + "Dictionary", + "Edge", + "Endpoint", + "EndpointAddresses", + "EngagementCredentials", + "EngagementWithCredentials", + "Error", + "Family", + "FindAvailableReservationsResponse", + "GetQuiltCalibrationsResponse", + "Group", + "Health", + "InstructionSetArchitecture", + "InviteUserRequest", + "ListAccountBillingInvoiceLinesResponse", + "ListAccountBillingInvoicesResponse", + "ListClientApplicationsResponse", + "ListEndpointsResponse", + "ListGroupReservationsShowDeleted", + "ListGroupsResponse", + "ListGroupUsersResponse", + "ListQuantumProcessorAccessorsResponse", + "ListQuantumProcessorsResponse", + "ListReservationsResponse", + "ListReservationsShowDeleted", + "Node", + "NomadJobDatacenters", + "Operation", + "OperationSite", + "Parameter", + "ParameterSpec", + "QuantumProcessor", + "QuantumProcessorAccessor", + "QuantumProcessorAccessorType", + "RemoveGroupUserRequest", + "Reservation", + "RestartEndpointRequest", + "Tier", + "TranslateNativeQuilToEncryptedBinaryRequest", + "TranslateNativeQuilToEncryptedBinaryResponse", + "TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors", + "User", + "UserCredentials", + "UserCredentialsPassword", + "UserProfile", + "ValidationError", + "ValidationErrorIn", +) diff --git a/qcs_api_client/models/account_balance.py b/qcs_api_client/models/account_balance.py index c67dbf9..a1b7eab 100644 --- a/qcs_api_client/models/account_balance.py +++ b/qcs_api_client/models/account_balance.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="AccountBalance") -@attr.s(auto_attribs=True) +@_attrs_define class AccountBalance: """Balance of QCS account in billing system. Note, a negative balance signifies that the account has QCS credits to spend. A positive account balance signifies that the account has no additional QCS credits to spend. The QCS UI may @@ -19,7 +24,7 @@ class AccountBalance: """ balance: int - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: balance = self.balance diff --git a/qcs_api_client/models/add_group_user_request.py b/qcs_api_client/models/add_group_user_request.py index ea45b80..4b78d9c 100644 --- a/qcs_api_client/models/add_group_user_request.py +++ b/qcs_api_client/models/add_group_user_request.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="AddGroupUserRequest") -@attr.s(auto_attribs=True) +@_attrs_define class AddGroupUserRequest: """Must provide either `userId` or `userEmail` and `groupId` or `groupName`. @@ -23,12 +31,15 @@ class AddGroupUserRequest: group_name: Union[Unset, str] = UNSET user_email: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: group_id = self.group_id + group_name = self.group_name + user_email = self.user_email + user_id = self.user_id field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/architecture.py b/qcs_api_client/models/architecture.py index 5597a44..8ef26a5 100644 --- a/qcs_api_client/models/architecture.py +++ b/qcs_api_client/models/architecture.py @@ -1,17 +1,24 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr -from ..models.edge import Edge -from ..models.family import Family -from ..models.node import Node +from attrs import define as _attrs_define + from ..types import UNSET from ..util.serialization import is_not_none + +from ..models.family import Family +from typing import List + +if TYPE_CHECKING: + from ..models.node import Node + from ..models.edge import Edge + + T = TypeVar("T", bound="Architecture") -@attr.s(auto_attribs=True) +@_attrs_define class Architecture: """Represents the logical underlying architecture of a quantum processor. @@ -33,7 +40,7 @@ class Architecture: that any 1Q or 2Q operation will be available to users writing QUIL programs. Attributes: - edges (List[Edge]): A list of all computational edges in the instruction set architecture. + edges (List['Edge']): A list of all computational edges in the instruction set architecture. family (Family): Family identifier. Value 'None' implies the architecture has no specific layout topology. @@ -41,18 +48,17 @@ class Architecture: For other values based on deployed architecture layouts (e.g. `Aspen` and `Ankaa`), refer to the architecture classes themselves for more details. - nodes (List[Node]): A list of all computational nodes in the instruction set architecture. + nodes (List['Node']): A list of all computational nodes in the instruction set architecture. """ - edges: List[Edge] + edges: List["Edge"] family: Family - nodes: List[Node] + nodes: List["Node"] def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: edges = [] for edges_item_data in self.edges: edges_item = edges_item_data.to_dict() - edges.append(edges_item) family = self.family.value @@ -60,7 +66,6 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no nodes = [] for nodes_item_data in self.nodes: nodes_item = nodes_item_data.to_dict() - nodes.append(nodes_item) field_dict: Dict[str, Any] = {} @@ -80,6 +85,9 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.node import Node + from ..models.edge import Edge + d = src_dict.copy() edges = [] _edges = d.pop("edges") diff --git a/qcs_api_client/models/auth_email_password_reset_token_request.py b/qcs_api_client/models/auth_email_password_reset_token_request.py index 5377e68..fa8664e 100644 --- a/qcs_api_client/models/auth_email_password_reset_token_request.py +++ b/qcs_api_client/models/auth_email_password_reset_token_request.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="AuthEmailPasswordResetTokenRequest") -@attr.s(auto_attribs=True) +@_attrs_define class AuthEmailPasswordResetTokenRequest: """ Attributes: @@ -16,7 +21,7 @@ class AuthEmailPasswordResetTokenRequest: """ email: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: email = self.email diff --git a/qcs_api_client/models/auth_reset_password_request.py b/qcs_api_client/models/auth_reset_password_request.py index f7a24e7..04f9387 100644 --- a/qcs_api_client/models/auth_reset_password_request.py +++ b/qcs_api_client/models/auth_reset_password_request.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="AuthResetPasswordRequest") -@attr.s(auto_attribs=True) +@_attrs_define class AuthResetPasswordRequest: """ Attributes: @@ -18,10 +23,11 @@ class AuthResetPasswordRequest: new_password: str old_password: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: new_password = self.new_password + old_password = self.old_password field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/auth_reset_password_with_token_request.py b/qcs_api_client/models/auth_reset_password_with_token_request.py index 84c5d2d..ec464e5 100644 --- a/qcs_api_client/models/auth_reset_password_with_token_request.py +++ b/qcs_api_client/models/auth_reset_password_with_token_request.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="AuthResetPasswordWithTokenRequest") -@attr.s(auto_attribs=True) +@_attrs_define class AuthResetPasswordWithTokenRequest: """Token may be requested with AuthEmailPasswordResetToken. @@ -19,10 +24,11 @@ class AuthResetPasswordWithTokenRequest: new_password: str token: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: new_password = self.new_password + token = self.token field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/available_reservation.py b/qcs_api_client/models/available_reservation.py index ee88c74..3973268 100644 --- a/qcs_api_client/models/available_reservation.py +++ b/qcs_api_client/models/available_reservation.py @@ -1,17 +1,24 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 from ..types import UNSET from ..util.serialization import is_not_none + +from dateutil.parser import isoparse +import datetime + + T = TypeVar("T", bound="AvailableReservation") -@attr.s(auto_attribs=True) +@_attrs_define class AvailableReservation: """ Attributes: @@ -27,15 +34,18 @@ class AvailableReservation: price: int quantum_processor_id: str start_time: datetime.datetime - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: duration = self.duration + assert self.end_time.tzinfo is not None, "Datetime must have timezone information" end_time = rfc3339(self.end_time) price = self.price + quantum_processor_id = self.quantum_processor_id + assert self.start_time.tzinfo is not None, "Datetime must have timezone information" start_time = rfc3339(self.start_time) diff --git a/qcs_api_client/models/billing_customer.py b/qcs_api_client/models/billing_customer.py index 0cca461..ac7403f 100644 --- a/qcs_api_client/models/billing_customer.py +++ b/qcs_api_client/models/billing_customer.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="BillingCustomer") -@attr.s(auto_attribs=True) +@_attrs_define class BillingCustomer: """A representation of a QCS's account billing customer. Note, `balance` does not account for the upcoming invoice. @@ -19,10 +24,11 @@ class BillingCustomer: email: str id: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: email = self.email + id = self.id field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/billing_invoice.py b/qcs_api_client/models/billing_invoice.py index 3484f62..b16dc3e 100644 --- a/qcs_api_client/models/billing_invoice.py +++ b/qcs_api_client/models/billing_invoice.py @@ -1,18 +1,25 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 -from ..models.billing_invoice_status import BillingInvoiceStatus from ..types import UNSET from ..util.serialization import is_not_none + +from ..models.billing_invoice_status import BillingInvoiceStatus +from dateutil.parser import isoparse +import datetime + + T = TypeVar("T", bound="BillingInvoice") -@attr.s(auto_attribs=True) +@_attrs_define class BillingInvoice: """A finalized billing invoice. @@ -35,7 +42,7 @@ class BillingInvoice: tax: int total: int id: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.period_end.tzinfo is not None, "Datetime must have timezone information" @@ -45,11 +52,15 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no period_start = rfc3339(self.period_start) starting_balance = self.starting_balance + status = self.status.value subtotal = self.subtotal + tax = self.tax + total = self.total + id = self.id field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/billing_invoice_line.py b/qcs_api_client/models/billing_invoice_line.py index 4492055..62c90e6 100644 --- a/qcs_api_client/models/billing_invoice_line.py +++ b/qcs_api_client/models/billing_invoice_line.py @@ -1,17 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.billing_invoice_line_line_item_type import BillingInvoiceLineLineItemType -from ..models.billing_invoice_line_metadata import BillingInvoiceLineMetadata -from ..models.billing_price import BillingPrice from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.billing_invoice_line_line_item_type import BillingInvoiceLineLineItemType +from typing import Union + +if TYPE_CHECKING: + from ..models.billing_price import BillingPrice + from ..models.billing_invoice_line_metadata import BillingInvoiceLineMetadata + + T = TypeVar("T", bound="BillingInvoiceLine") -@attr.s(auto_attribs=True) +@_attrs_define class BillingInvoiceLine: """A line item on an invoice representing a particular purchase (such as a reservation) or aggregate usage for the invoice period. @@ -33,29 +43,35 @@ class BillingInvoiceLine: description: str id: str line_item_type: BillingInvoiceLineLineItemType - metadata: BillingInvoiceLineMetadata + metadata: "BillingInvoiceLineMetadata" quantity: int invoice_item: Union[Unset, str] = UNSET - price: Union[Unset, BillingPrice] = UNSET + price: Union[Unset, "BillingPrice"] = UNSET subscription: Union[Unset, str] = UNSET subscription_item: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: amount = self.amount + description = self.description + id = self.id + line_item_type = self.line_item_type.value metadata = self.metadata.to_dict() quantity = self.quantity + invoice_item = self.invoice_item + price: Union[Unset, Dict[str, Any]] = UNSET if not isinstance(self.price, Unset): price = self.price.to_dict() subscription = self.subscription + subscription_item = self.subscription_item field_dict: Dict[str, Any] = {} @@ -87,6 +103,9 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.billing_price import BillingPrice + from ..models.billing_invoice_line_metadata import BillingInvoiceLineMetadata + d = src_dict.copy() amount = d.pop("amount") diff --git a/qcs_api_client/models/billing_invoice_line_metadata.py b/qcs_api_client/models/billing_invoice_line_metadata.py index 2bcca87..416099e 100644 --- a/qcs_api_client/models/billing_invoice_line_metadata.py +++ b/qcs_api_client/models/billing_invoice_line_metadata.py @@ -1,24 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="BillingInvoiceLineMetadata") -@attr.s(auto_attribs=True) +@_attrs_define class BillingInvoiceLineMetadata: """ """ - additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, str] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: - field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({}) field_dict = {k: v for k, v in field_dict.items() if v != UNSET} if pick_by_predicate is not None: diff --git a/qcs_api_client/models/billing_price.py b/qcs_api_client/models/billing_price.py index 68e0f3c..b013158 100644 --- a/qcs_api_client/models/billing_price.py +++ b/qcs_api_client/models/billing_price.py @@ -1,21 +1,31 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset +from ..util.serialization import is_not_none + + +from ..models.billing_price_tiers_mode import BillingPriceTiersMode from ..models.billing_price_object import BillingPriceObject from ..models.billing_price_price_type import BillingPricePriceType -from ..models.billing_price_recurrence import BillingPriceRecurrence from ..models.billing_price_scheme import BillingPriceScheme -from ..models.billing_price_tiers_mode import BillingPriceTiersMode -from ..models.billing_product import BillingProduct -from ..models.tier import Tier -from ..types import UNSET, Unset -from ..util.serialization import is_not_none +from typing import Union + +if TYPE_CHECKING: + from ..models.tier import Tier + from ..models.billing_product import BillingProduct + from ..models.billing_price_recurrence import BillingPriceRecurrence + T = TypeVar("T", bound="BillingPrice") -@attr.s(auto_attribs=True) +@_attrs_define class BillingPrice: """The price schedule for a particular service applied to an invoice line item. @@ -35,7 +45,7 @@ class BillingPrice: reservations) or metered services. recurring (Union[Unset, BillingPriceRecurrence]): The recurring components of a price such as `interval` and `usageType`. - tiers (Union[Unset, List[Tier]]): Each element represents a pricing tier. This parameter requires + tiers (Union[Unset, List['Tier']]): Each element represents a pricing tier. This parameter requires `billingScheme` to be set to `tiered`. See also the documentation for `billingScheme`. tiers_mode (Union[Unset, BillingPriceTiersMode]): Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in @@ -49,16 +59,18 @@ class BillingPrice: billing_scheme: Union[Unset, BillingPriceScheme] = UNSET object_: Union[Unset, BillingPriceObject] = UNSET price_type: Union[Unset, BillingPricePriceType] = UNSET - product: Union[Unset, BillingProduct] = UNSET - recurring: Union[Unset, BillingPriceRecurrence] = UNSET - tiers: Union[Unset, List[Tier]] = UNSET + product: Union[Unset, "BillingProduct"] = UNSET + recurring: Union[Unset, "BillingPriceRecurrence"] = UNSET + tiers: Union[Unset, List["Tier"]] = UNSET tiers_mode: Union[Unset, BillingPriceTiersMode] = UNSET unit_amount_decimal: Union[Unset, float] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: id = self.id + active = self.active + billing_scheme: Union[Unset, str] = UNSET if not isinstance(self.billing_scheme, Unset): billing_scheme = self.billing_scheme.value @@ -84,7 +96,6 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no tiers = [] for tiers_item_data in self.tiers: tiers_item = tiers_item_data.to_dict() - tiers.append(tiers_item) tiers_mode: Union[Unset, str] = UNSET @@ -127,6 +138,10 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.tier import Tier + from ..models.billing_product import BillingProduct + from ..models.billing_price_recurrence import BillingPriceRecurrence + d = src_dict.copy() id = d.pop("id") diff --git a/qcs_api_client/models/billing_price_recurrence.py b/qcs_api_client/models/billing_price_recurrence.py index 1126245..9b4d7de 100644 --- a/qcs_api_client/models/billing_price_recurrence.py +++ b/qcs_api_client/models/billing_price_recurrence.py @@ -1,17 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.billing_price_recurrence_aggregate_usage import BillingPriceRecurrenceAggregateUsage -from ..models.billing_price_recurrence_interval import BillingPriceRecurrenceInterval -from ..models.billing_price_recurrence_usage_type import BillingPriceRecurrenceUsageType from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.billing_price_recurrence_aggregate_usage import ( + BillingPriceRecurrenceAggregateUsage, +) +from ..models.billing_price_recurrence_usage_type import BillingPriceRecurrenceUsageType +from ..models.billing_price_recurrence_interval import BillingPriceRecurrenceInterval +from typing import Union + + T = TypeVar("T", bound="BillingPriceRecurrence") -@attr.s(auto_attribs=True) +@_attrs_define class BillingPriceRecurrence: """The recurring components of a price such as `interval` and `usageType`. @@ -26,7 +36,7 @@ class BillingPriceRecurrence: aggregate_usage: Union[Unset, BillingPriceRecurrenceAggregateUsage] = UNSET interval_count: Union[Unset, int] = UNSET usage_type: Union[Unset, BillingPriceRecurrenceUsageType] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: interval = self.interval.value @@ -36,6 +46,7 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no aggregate_usage = self.aggregate_usage.value interval_count = self.interval_count + usage_type: Union[Unset, str] = UNSET if not isinstance(self.usage_type, Unset): usage_type = self.usage_type.value diff --git a/qcs_api_client/models/billing_product.py b/qcs_api_client/models/billing_product.py index 08bc7d4..a7782e3 100644 --- a/qcs_api_client/models/billing_product.py +++ b/qcs_api_client/models/billing_product.py @@ -1,15 +1,23 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.billing_product_object import BillingProductObject from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.billing_product_object import BillingProductObject +from typing import Union + + T = TypeVar("T", bound="BillingProduct") -@attr.s(auto_attribs=True) +@_attrs_define class BillingProduct: """A QCS service product. This may represent one time (such as reservations) or metered services. @@ -28,14 +36,17 @@ class BillingProduct: object_: BillingProductObject description: Union[Unset, str] = UNSET unit_label: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: id = self.id + name = self.name + object_ = self.object_.value description = self.description + unit_label = self.unit_label field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/billing_upcoming_invoice.py b/qcs_api_client/models/billing_upcoming_invoice.py index 17db396..333c36e 100644 --- a/qcs_api_client/models/billing_upcoming_invoice.py +++ b/qcs_api_client/models/billing_upcoming_invoice.py @@ -1,18 +1,25 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 -from ..models.billing_invoice_status import BillingInvoiceStatus from ..types import UNSET from ..util.serialization import is_not_none + +from ..models.billing_invoice_status import BillingInvoiceStatus +from dateutil.parser import isoparse +import datetime + + T = TypeVar("T", bound="BillingUpcomingInvoice") -@attr.s(auto_attribs=True) +@_attrs_define class BillingUpcomingInvoice: """An unfinalized billing invoice. @@ -33,7 +40,7 @@ class BillingUpcomingInvoice: subtotal: int tax: int total: int - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.period_end.tzinfo is not None, "Datetime must have timezone information" @@ -43,10 +50,13 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no period_start = rfc3339(self.period_start) starting_balance = self.starting_balance + status = self.status.value subtotal = self.subtotal + tax = self.tax + total = self.total field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/characteristic.py b/qcs_api_client/models/characteristic.py index a974334..43003a6 100644 --- a/qcs_api_client/models/characteristic.py +++ b/qcs_api_client/models/characteristic.py @@ -1,17 +1,23 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse + +from attrs import define as _attrs_define from rfc3339 import rfc3339 from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast, List +from dateutil.parser import isoparse +from typing import Union +import datetime + + T = TypeVar("T", bound="Characteristic") -@attr.s(auto_attribs=True) +@_attrs_define class Characteristic: """A measured characteristic of an operation. @@ -37,11 +43,14 @@ class Characteristic: def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: name = self.name + assert self.timestamp.tzinfo is not None, "Datetime must have timezone information" timestamp = rfc3339(self.timestamp) value = self.value + error = self.error + node_ids: Union[Unset, List[int]] = UNSET if not isinstance(self.node_ids, Unset): node_ids = self.node_ids diff --git a/qcs_api_client/models/check_client_application_request.py b/qcs_api_client/models/check_client_application_request.py index afac6ee..a43a14a 100644 --- a/qcs_api_client/models/check_client_application_request.py +++ b/qcs_api_client/models/check_client_application_request.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="CheckClientApplicationRequest") -@attr.s(auto_attribs=True) +@_attrs_define class CheckClientApplicationRequest: """ Attributes: @@ -18,10 +23,11 @@ class CheckClientApplicationRequest: name: str version: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: name = self.name + version = self.version field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/check_client_application_response.py b/qcs_api_client/models/check_client_application_response.py index feea83d..8990fcc 100644 --- a/qcs_api_client/models/check_client_application_response.py +++ b/qcs_api_client/models/check_client_application_response.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="CheckClientApplicationResponse") -@attr.s(auto_attribs=True) +@_attrs_define class CheckClientApplicationResponse: """ Attributes: @@ -20,11 +25,13 @@ class CheckClientApplicationResponse: is_latest_version: bool is_update_required: bool message: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: is_latest_version = self.is_latest_version + is_update_required = self.is_update_required + message = self.message field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/checksum_description.py b/qcs_api_client/models/checksum_description.py index 2d67969..aa0aa51 100644 --- a/qcs_api_client/models/checksum_description.py +++ b/qcs_api_client/models/checksum_description.py @@ -1,15 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.checksum_description_type import ChecksumDescriptionType from ..types import UNSET from ..util.serialization import is_not_none + +from ..models.checksum_description_type import ChecksumDescriptionType + + T = TypeVar("T", bound="ChecksumDescription") -@attr.s(auto_attribs=True) +@_attrs_define class ChecksumDescription: """ Attributes: @@ -19,10 +26,11 @@ class ChecksumDescription: header_name: str type: ChecksumDescriptionType - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: header_name = self.header_name + type = self.type.value field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/client_application.py b/qcs_api_client/models/client_application.py index 2185931..90aead6 100644 --- a/qcs_api_client/models/client_application.py +++ b/qcs_api_client/models/client_application.py @@ -1,15 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.client_applications_download_link import ClientApplicationsDownloadLink from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.client_applications_download_link import ( + ClientApplicationsDownloadLink, + ) + + T = TypeVar("T", bound="ClientApplication") -@attr.s(auto_attribs=True) +@_attrs_define class ClientApplication: """ Attributes: @@ -17,7 +29,7 @@ class ClientApplication: name (str): supported (bool): details_uri (Union[Unset, str]): - links (Union[Unset, List[ClientApplicationsDownloadLink]]): + links (Union[Unset, List['ClientApplicationsDownloadLink']]): minimum_version (Union[Unset, str]): Semantic version """ @@ -25,21 +37,24 @@ class ClientApplication: name: str supported: bool details_uri: Union[Unset, str] = UNSET - links: Union[Unset, List[ClientApplicationsDownloadLink]] = UNSET + links: Union[Unset, List["ClientApplicationsDownloadLink"]] = UNSET minimum_version: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: latest_version = self.latest_version + name = self.name + supported = self.supported + details_uri = self.details_uri + links: Union[Unset, List[Dict[str, Any]]] = UNSET if not isinstance(self.links, Unset): links = [] for links_item_data in self.links: links_item = links_item_data.to_dict() - links.append(links_item) minimum_version = self.minimum_version @@ -68,6 +83,10 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.client_applications_download_link import ( + ClientApplicationsDownloadLink, + ) + d = src_dict.copy() latest_version = d.pop("latestVersion") diff --git a/qcs_api_client/models/client_applications_download_link.py b/qcs_api_client/models/client_applications_download_link.py index d215244..3b06225 100644 --- a/qcs_api_client/models/client_applications_download_link.py +++ b/qcs_api_client/models/client_applications_download_link.py @@ -1,15 +1,25 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.checksum_description import ChecksumDescription from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.checksum_description import ChecksumDescription + + T = TypeVar("T", bound="ClientApplicationsDownloadLink") -@attr.s(auto_attribs=True) +@_attrs_define class ClientApplicationsDownloadLink: """ Attributes: @@ -19,12 +29,13 @@ class ClientApplicationsDownloadLink: """ url: str - checksum_description: Union[Unset, ChecksumDescription] = UNSET + checksum_description: Union[Unset, "ChecksumDescription"] = UNSET platform: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: url = self.url + checksum_description: Union[Unset, Dict[str, Any]] = UNSET if not isinstance(self.checksum_description, Unset): checksum_description = self.checksum_description.to_dict() @@ -51,6 +62,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.checksum_description import ChecksumDescription + d = src_dict.copy() url = d.pop("url") diff --git a/qcs_api_client/models/create_endpoint_parameters.py b/qcs_api_client/models/create_endpoint_parameters.py index f3463c0..321c703 100644 --- a/qcs_api_client/models/create_endpoint_parameters.py +++ b/qcs_api_client/models/create_endpoint_parameters.py @@ -1,15 +1,24 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.nomad_job_datacenters import NomadJobDatacenters from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast +from ..models.nomad_job_datacenters import NomadJobDatacenters +from typing import Union + + T = TypeVar("T", bound="CreateEndpointParameters") -@attr.s(auto_attribs=True) +@_attrs_define class CreateEndpointParameters: """A publicly available set of parameters for defining an endpoint. @@ -22,7 +31,7 @@ class CreateEndpointParameters: datacenters: Union[Unset, List[NomadJobDatacenters]] = UNSET quantum_processor_ids: Union[Unset, List[str]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: datacenters: Union[Unset, List[str]] = UNSET @@ -30,7 +39,6 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no datacenters = [] for datacenters_item_data in self.datacenters: datacenters_item = datacenters_item_data.value - datacenters.append(datacenters_item) quantum_processor_ids: Union[Unset, List[str]] = UNSET diff --git a/qcs_api_client/models/create_engagement_request.py b/qcs_api_client/models/create_engagement_request.py index b131ae5..2f586c9 100644 --- a/qcs_api_client/models/create_engagement_request.py +++ b/qcs_api_client/models/create_engagement_request.py @@ -1,15 +1,24 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.account_type import AccountType from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast +from typing import Union +from ..models.account_type import AccountType + + T = TypeVar("T", bound="CreateEngagementRequest") -@attr.s(auto_attribs=True) +@_attrs_define class CreateEngagementRequest: """ Attributes: @@ -29,16 +38,19 @@ class CreateEngagementRequest: endpoint_id: Union[Unset, str] = UNSET quantum_processor_id: Union[Unset, str] = UNSET tags: Union[Unset, List[str]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: account_id = self.account_id + account_type: Union[Unset, str] = UNSET if not isinstance(self.account_type, Unset): account_type = self.account_type.value endpoint_id = self.endpoint_id + quantum_processor_id = self.quantum_processor_id + tags: Union[Unset, List[str]] = UNSET if not isinstance(self.tags, Unset): tags = self.tags diff --git a/qcs_api_client/models/create_reservation_request.py b/qcs_api_client/models/create_reservation_request.py index 2373688..79870af 100644 --- a/qcs_api_client/models/create_reservation_request.py +++ b/qcs_api_client/models/create_reservation_request.py @@ -1,18 +1,26 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 -from ..models.account_type import AccountType from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.account_type import AccountType +from dateutil.parser import isoparse +import datetime +from typing import Union + + T = TypeVar("T", bound="CreateReservationRequest") -@attr.s(auto_attribs=True) +@_attrs_define class CreateReservationRequest: """ Attributes: @@ -32,17 +40,19 @@ class CreateReservationRequest: account_id: Union[Unset, str] = UNSET account_type: Union[Unset, AccountType] = UNSET notes: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.end_time.tzinfo is not None, "Datetime must have timezone information" end_time = rfc3339(self.end_time) quantum_processor_id = self.quantum_processor_id + assert self.start_time.tzinfo is not None, "Datetime must have timezone information" start_time = rfc3339(self.start_time) account_id = self.account_id + account_type: Union[Unset, str] = UNSET if not isinstance(self.account_type, Unset): account_type = self.account_type.value diff --git a/qcs_api_client/models/dictionary.py b/qcs_api_client/models/dictionary.py index 519d32b..517f469 100644 --- a/qcs_api_client/models/dictionary.py +++ b/qcs_api_client/models/dictionary.py @@ -1,24 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="Dictionary") -@attr.s(auto_attribs=True) +@_attrs_define class Dictionary: """Generic, arbitrary Dictionary""" - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: - field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({}) field_dict = {k: v for k, v in field_dict.items() if v != UNSET} if pick_by_predicate is not None: diff --git a/qcs_api_client/models/edge.py b/qcs_api_client/models/edge.py index 7d1cee7..0efa7f7 100644 --- a/qcs_api_client/models/edge.py +++ b/qcs_api_client/models/edge.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr + +from attrs import define as _attrs_define from ..types import UNSET from ..util.serialization import is_not_none + +from typing import cast, List + + T = TypeVar("T", bound="Edge") -@attr.s(auto_attribs=True) +@_attrs_define class Edge: """A degree-two logical connection in the quantum processor's architecture. diff --git a/qcs_api_client/models/endpoint.py b/qcs_api_client/models/endpoint.py index d07a732..1cc9390 100644 --- a/qcs_api_client/models/endpoint.py +++ b/qcs_api_client/models/endpoint.py @@ -1,15 +1,26 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.endpoint_addresses import EndpointAddresses from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast +from typing import Union + +if TYPE_CHECKING: + from ..models.endpoint_addresses import EndpointAddresses + + T = TypeVar("T", bound="Endpoint") -@attr.s(auto_attribs=True) +@_attrs_define class Endpoint: """An Endpoint is the entry point for remote access to a QuantumProcessor. @@ -18,29 +29,38 @@ class Endpoint: healthy (bool): Whether the endpoint is operating as intended id (str): Unique, opaque identifier for the endpoint mock (bool): Whether the endpoint serves simulated or substituted data for testing purposes - address (Union[Unset, None, str]): Network address at which the endpoint is locally reachable + address (Union[None, Unset, str]): Network address at which the endpoint is locally reachable datacenter (Union[Unset, str]): Datacenter within which the endpoint is deployed quantum_processor_ids (Union[Unset, List[str]]): Public identifiers for quantum processors served by this endpoint. """ - addresses: EndpointAddresses + addresses: "EndpointAddresses" healthy: bool id: str mock: bool - address: Union[Unset, None, str] = UNSET + address: Union[None, Unset, str] = UNSET datacenter: Union[Unset, str] = UNSET quantum_processor_ids: Union[Unset, List[str]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: addresses = self.addresses.to_dict() healthy = self.healthy + id = self.id + mock = self.mock - address = self.address + + address: Union[None, Unset, str] + if isinstance(self.address, Unset): + address = UNSET + else: + address = self.address + datacenter = self.datacenter + quantum_processor_ids: Union[Unset, List[str]] = UNSET if not isinstance(self.quantum_processor_ids, Unset): quantum_processor_ids = self.quantum_processor_ids @@ -70,6 +90,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.endpoint_addresses import EndpointAddresses + d = src_dict.copy() addresses = EndpointAddresses.from_dict(d.pop("addresses")) @@ -79,7 +101,14 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: mock = d.pop("mock") - address = d.pop("address", UNSET) + def _parse_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + address = _parse_address(d.pop("address", UNSET)) datacenter = d.pop("datacenter", UNSET) diff --git a/qcs_api_client/models/endpoint_addresses.py b/qcs_api_client/models/endpoint_addresses.py index 04dead7..96e60fb 100644 --- a/qcs_api_client/models/endpoint_addresses.py +++ b/qcs_api_client/models/endpoint_addresses.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="EndpointAddresses") -@attr.s(auto_attribs=True) +@_attrs_define class EndpointAddresses: """Addresses at which an endpoint is reachable over the network. @@ -19,10 +27,11 @@ class EndpointAddresses: grpc: Union[Unset, str] = UNSET rpcq: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: grpc = self.grpc + rpcq = self.rpcq field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/engagement_credentials.py b/qcs_api_client/models/engagement_credentials.py index 646ad7b..778e216 100644 --- a/qcs_api_client/models/engagement_credentials.py +++ b/qcs_api_client/models/engagement_credentials.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="EngagementCredentials") -@attr.s(auto_attribs=True) +@_attrs_define class EngagementCredentials: """Credentials are the ZeroMQ CURVE Keys used to encrypt the connection with the Quantum Processor Endpoint. @@ -22,11 +27,13 @@ class EngagementCredentials: client_public: str client_secret: str server_public: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: client_public = self.client_public + client_secret = self.client_secret + server_public = self.server_public field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/engagement_with_credentials.py b/qcs_api_client/models/engagement_with_credentials.py index a576849..4e6897f 100644 --- a/qcs_api_client/models/engagement_with_credentials.py +++ b/qcs_api_client/models/engagement_with_credentials.py @@ -1,16 +1,27 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.account_type import AccountType -from ..models.engagement_credentials import EngagementCredentials from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast +from ..models.account_type import AccountType +from typing import Union + +if TYPE_CHECKING: + from ..models.engagement_credentials import EngagementCredentials + + T = TypeVar("T", bound="EngagementWithCredentials") -@attr.s(auto_attribs=True) +@_attrs_define class EngagementWithCredentials: """An engagement is the authorization of a user to execute work on a Quantum Processor Endpoint. @@ -33,7 +44,7 @@ class EngagementWithCredentials: """ address: str - credentials: EngagementCredentials + credentials: "EngagementCredentials" endpoint_id: str expires_at: str user_id: str @@ -42,21 +53,27 @@ class EngagementWithCredentials: minimum_priority: Union[Unset, int] = UNSET quantum_processor_ids: Union[Unset, List[str]] = UNSET tags: Union[Unset, List[str]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: address = self.address + credentials = self.credentials.to_dict() endpoint_id = self.endpoint_id + expires_at = self.expires_at + user_id = self.user_id + account_id = self.account_id + account_type: Union[Unset, str] = UNSET if not isinstance(self.account_type, Unset): account_type = self.account_type.value minimum_priority = self.minimum_priority + quantum_processor_ids: Union[Unset, List[str]] = UNSET if not isinstance(self.quantum_processor_ids, Unset): quantum_processor_ids = self.quantum_processor_ids @@ -95,6 +112,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.engagement_credentials import EngagementCredentials + d = src_dict.copy() address = d.pop("address") diff --git a/qcs_api_client/models/error.py b/qcs_api_client/models/error.py index 11b1611..f7f77ab 100644 --- a/qcs_api_client/models/error.py +++ b/qcs_api_client/models/error.py @@ -1,40 +1,52 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.validation_error import ValidationError from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.validation_error import ValidationError + + T = TypeVar("T", bound="Error") -@attr.s(auto_attribs=True) +@_attrs_define class Error: """ Attributes: code (str): message (str): request_id (str): - validation_errors (Union[Unset, List[ValidationError]]): + validation_errors (Union[Unset, List['ValidationError']]): """ code: str message: str request_id: str - validation_errors: Union[Unset, List[ValidationError]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + validation_errors: Union[Unset, List["ValidationError"]] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: code = self.code + message = self.message + request_id = self.request_id + validation_errors: Union[Unset, List[Dict[str, Any]]] = UNSET if not isinstance(self.validation_errors, Unset): validation_errors = [] for validation_errors_item_data in self.validation_errors: validation_errors_item = validation_errors_item_data.to_dict() - validation_errors.append(validation_errors_item) field_dict: Dict[str, Any] = {} @@ -57,6 +69,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.validation_error import ValidationError + d = src_dict.copy() code = d.pop("code") diff --git a/qcs_api_client/models/family.py b/qcs_api_client/models/family.py index b7967dd..1e41686 100644 --- a/qcs_api_client/models/family.py +++ b/qcs_api_client/models/family.py @@ -2,10 +2,10 @@ class Family(str, Enum): - NONE = "None" - FULL = "Full" - ASPEN = "Aspen" ANKAA = "Ankaa" + ASPEN = "Aspen" + FULL = "Full" + NONE = "None" def __str__(self) -> str: return str(self.value) diff --git a/qcs_api_client/models/find_available_reservations_response.py b/qcs_api_client/models/find_available_reservations_response.py index c58034c..60fdc89 100644 --- a/qcs_api_client/models/find_available_reservations_response.py +++ b/qcs_api_client/models/find_available_reservations_response.py @@ -1,31 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.available_reservation import AvailableReservation from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.available_reservation import AvailableReservation + + T = TypeVar("T", bound="FindAvailableReservationsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class FindAvailableReservationsResponse: """ Attributes: - available_reservations (List[AvailableReservation]): + available_reservations (List['AvailableReservation']): next_page_token (Union[Unset, str]): """ - available_reservations: List[AvailableReservation] + available_reservations: List["AvailableReservation"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: available_reservations = [] for available_reservations_item_data in self.available_reservations: available_reservations_item = available_reservations_item_data.to_dict() - available_reservations.append(available_reservations_item) next_page_token = self.next_page_token @@ -48,6 +57,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.available_reservation import AvailableReservation + d = src_dict.copy() available_reservations = [] _available_reservations = d.pop("availableReservations") diff --git a/qcs_api_client/models/get_quilt_calibrations_response.py b/qcs_api_client/models/get_quilt_calibrations_response.py index 590f91b..3631d3b 100644 --- a/qcs_api_client/models/get_quilt_calibrations_response.py +++ b/qcs_api_client/models/get_quilt_calibrations_response.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="GetQuiltCalibrationsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class GetQuiltCalibrationsResponse: """ Attributes: @@ -18,10 +26,11 @@ class GetQuiltCalibrationsResponse: quilt: str settings_timestamp: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: quilt = self.quilt + settings_timestamp = self.settings_timestamp field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/group.py b/qcs_api_client/models/group.py index b67aa08..9e2a06c 100644 --- a/qcs_api_client/models/group.py +++ b/qcs_api_client/models/group.py @@ -1,17 +1,24 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 from ..types import UNSET from ..util.serialization import is_not_none + +from dateutil.parser import isoparse +import datetime + + T = TypeVar("T", bound="Group") -@attr.s(auto_attribs=True) +@_attrs_define class Group: """ Attributes: @@ -29,18 +36,21 @@ class Group: last_membership_updated_time: datetime.datetime name: str updated_time: datetime.datetime - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.created_time.tzinfo is not None, "Datetime must have timezone information" created_time = rfc3339(self.created_time) description = self.description + id = self.id + assert self.last_membership_updated_time.tzinfo is not None, "Datetime must have timezone information" last_membership_updated_time = rfc3339(self.last_membership_updated_time) name = self.name + assert self.updated_time.tzinfo is not None, "Datetime must have timezone information" updated_time = rfc3339(self.updated_time) diff --git a/qcs_api_client/models/health.py b/qcs_api_client/models/health.py index ca395d9..a1a2860 100644 --- a/qcs_api_client/models/health.py +++ b/qcs_api_client/models/health.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="Health") -@attr.s(auto_attribs=True) +@_attrs_define class Health: """ Attributes: @@ -16,7 +21,7 @@ class Health: """ status: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: status = self.status diff --git a/qcs_api_client/models/instruction_set_architecture.py b/qcs_api_client/models/instruction_set_architecture.py index e8e2e39..2cc2c53 100644 --- a/qcs_api_client/models/instruction_set_architecture.py +++ b/qcs_api_client/models/instruction_set_architecture.py @@ -1,16 +1,23 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr -from ..models.architecture import Architecture -from ..models.operation import Operation +from attrs import define as _attrs_define + from ..types import UNSET from ..util.serialization import is_not_none + +from typing import List + +if TYPE_CHECKING: + from ..models.operation import Operation + from ..models.architecture import Architecture + + T = TypeVar("T", bound="InstructionSetArchitecture") -@attr.s(auto_attribs=True) +@_attrs_define class InstructionSetArchitecture: """The native instruction set architecture of a quantum processor, annotated with characteristics. @@ -40,14 +47,14 @@ class InstructionSetArchitecture: Note that the operations that are actually available are defined entirely by `Operation` instances. The presence of a node or edge in the `Architecture` model provides no guarantee that any 1Q or 2Q operation will be available to users writing QUIL programs. - benchmarks (List[Operation]): The list of benchmarks that have characterized the quantum processor. - instructions (List[Operation]): The list of native QUIL instructions supported by the quantum processor. + benchmarks (List['Operation']): The list of benchmarks that have characterized the quantum processor. + instructions (List['Operation']): The list of native QUIL instructions supported by the quantum processor. name (str): The name of the quantum processor. """ - architecture: Architecture - benchmarks: List[Operation] - instructions: List[Operation] + architecture: "Architecture" + benchmarks: List["Operation"] + instructions: List["Operation"] name: str def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: @@ -56,13 +63,11 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no benchmarks = [] for benchmarks_item_data in self.benchmarks: benchmarks_item = benchmarks_item_data.to_dict() - benchmarks.append(benchmarks_item) instructions = [] for instructions_item_data in self.instructions: instructions_item = instructions_item_data.to_dict() - instructions.append(instructions_item) name = self.name @@ -85,6 +90,9 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.operation import Operation + from ..models.architecture import Architecture + d = src_dict.copy() architecture = Architecture.from_dict(d.pop("architecture")) diff --git a/qcs_api_client/models/invite_user_request.py b/qcs_api_client/models/invite_user_request.py index 7302510..919a968 100644 --- a/qcs_api_client/models/invite_user_request.py +++ b/qcs_api_client/models/invite_user_request.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="InviteUserRequest") -@attr.s(auto_attribs=True) +@_attrs_define class InviteUserRequest: """ Attributes: @@ -18,10 +26,11 @@ class InviteUserRequest: email: str group_name: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: email = self.email + group_name = self.group_name field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/list_account_billing_invoice_lines_response.py b/qcs_api_client/models/list_account_billing_invoice_lines_response.py index 8b75211..66bfdce 100644 --- a/qcs_api_client/models/list_account_billing_invoice_lines_response.py +++ b/qcs_api_client/models/list_account_billing_invoice_lines_response.py @@ -1,31 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.billing_invoice_line import BillingInvoiceLine from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.billing_invoice_line import BillingInvoiceLine + + T = TypeVar("T", bound="ListAccountBillingInvoiceLinesResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListAccountBillingInvoiceLinesResponse: """ Attributes: - billing_invoice_lines (List[BillingInvoiceLine]): + billing_invoice_lines (List['BillingInvoiceLine']): next_page_token (Union[Unset, str]): """ - billing_invoice_lines: List[BillingInvoiceLine] + billing_invoice_lines: List["BillingInvoiceLine"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: billing_invoice_lines = [] for billing_invoice_lines_item_data in self.billing_invoice_lines: billing_invoice_lines_item = billing_invoice_lines_item_data.to_dict() - billing_invoice_lines.append(billing_invoice_lines_item) next_page_token = self.next_page_token @@ -48,6 +57,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.billing_invoice_line import BillingInvoiceLine + d = src_dict.copy() billing_invoice_lines = [] _billing_invoice_lines = d.pop("billingInvoiceLines") diff --git a/qcs_api_client/models/list_account_billing_invoices_response.py b/qcs_api_client/models/list_account_billing_invoices_response.py index 76f4476..ed7cf20 100644 --- a/qcs_api_client/models/list_account_billing_invoices_response.py +++ b/qcs_api_client/models/list_account_billing_invoices_response.py @@ -1,31 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.billing_invoice import BillingInvoice from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.billing_invoice import BillingInvoice + + T = TypeVar("T", bound="ListAccountBillingInvoicesResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListAccountBillingInvoicesResponse: """ Attributes: - billing_invoices (List[BillingInvoice]): + billing_invoices (List['BillingInvoice']): next_page_token (Union[Unset, str]): """ - billing_invoices: List[BillingInvoice] + billing_invoices: List["BillingInvoice"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: billing_invoices = [] for billing_invoices_item_data in self.billing_invoices: billing_invoices_item = billing_invoices_item_data.to_dict() - billing_invoices.append(billing_invoices_item) next_page_token = self.next_page_token @@ -48,6 +57,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.billing_invoice import BillingInvoice + d = src_dict.copy() billing_invoices = [] _billing_invoices = d.pop("billingInvoices") diff --git a/qcs_api_client/models/list_client_applications_response.py b/qcs_api_client/models/list_client_applications_response.py index 171ad28..2eacd6b 100644 --- a/qcs_api_client/models/list_client_applications_response.py +++ b/qcs_api_client/models/list_client_applications_response.py @@ -1,29 +1,36 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.client_application import ClientApplication from ..types import UNSET from ..util.serialization import is_not_none + +if TYPE_CHECKING: + from ..models.client_application import ClientApplication + + T = TypeVar("T", bound="ListClientApplicationsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListClientApplicationsResponse: """ Attributes: - client_applications (List[ClientApplication]): + client_applications (List['ClientApplication']): """ - client_applications: List[ClientApplication] - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + client_applications: List["ClientApplication"] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: client_applications = [] for client_applications_item_data in self.client_applications: client_applications_item = client_applications_item_data.to_dict() - client_applications.append(client_applications_item) field_dict: Dict[str, Any] = {} @@ -42,6 +49,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.client_application import ClientApplication + d = src_dict.copy() client_applications = [] _client_applications = d.pop("clientApplications") diff --git a/qcs_api_client/models/list_endpoints_response.py b/qcs_api_client/models/list_endpoints_response.py index 40ebbbb..35c74ca 100644 --- a/qcs_api_client/models/list_endpoints_response.py +++ b/qcs_api_client/models/list_endpoints_response.py @@ -1,32 +1,41 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.endpoint import Endpoint from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.endpoint import Endpoint + + T = TypeVar("T", bound="ListEndpointsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListEndpointsResponse: """ Attributes: - endpoints (List[Endpoint]): + endpoints (List['Endpoint']): next_page_token (Union[Unset, str]): Opaque token indicating the start of the next page of results to return; do not decode """ - endpoints: List[Endpoint] + endpoints: List["Endpoint"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: endpoints = [] for endpoints_item_data in self.endpoints: endpoints_item = endpoints_item_data.to_dict() - endpoints.append(endpoints_item) next_page_token = self.next_page_token @@ -49,6 +58,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.endpoint import Endpoint + d = src_dict.copy() endpoints = [] _endpoints = d.pop("endpoints") diff --git a/qcs_api_client/models/list_group_reservations_show_deleted.py b/qcs_api_client/models/list_group_reservations_show_deleted.py new file mode 100644 index 0000000..08c3e43 --- /dev/null +++ b/qcs_api_client/models/list_group_reservations_show_deleted.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class ListGroupReservationsShowDeleted(str, Enum): + FALSE = "false" + TRUE = "true" + + def __str__(self) -> str: + return str(self.value) diff --git a/qcs_api_client/models/list_group_users_response.py b/qcs_api_client/models/list_group_users_response.py index 74f3ed6..aa96264 100644 --- a/qcs_api_client/models/list_group_users_response.py +++ b/qcs_api_client/models/list_group_users_response.py @@ -1,31 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.user import User from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.user import User + + T = TypeVar("T", bound="ListGroupUsersResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListGroupUsersResponse: """ Attributes: - users (List[User]): + users (List['User']): next_page_token (Union[Unset, str]): """ - users: List[User] + users: List["User"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: users = [] for users_item_data in self.users: users_item = users_item_data.to_dict() - users.append(users_item) next_page_token = self.next_page_token @@ -48,6 +57,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.user import User + d = src_dict.copy() users = [] _users = d.pop("users") diff --git a/qcs_api_client/models/list_groups_response.py b/qcs_api_client/models/list_groups_response.py index 3e09d01..e4f084a 100644 --- a/qcs_api_client/models/list_groups_response.py +++ b/qcs_api_client/models/list_groups_response.py @@ -1,31 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.group import Group from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.group import Group + + T = TypeVar("T", bound="ListGroupsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListGroupsResponse: """ Attributes: - groups (List[Group]): + groups (List['Group']): next_page_token (Union[Unset, str]): """ - groups: List[Group] + groups: List["Group"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: groups = [] for groups_item_data in self.groups: groups_item = groups_item_data.to_dict() - groups.append(groups_item) next_page_token = self.next_page_token @@ -48,6 +57,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.group import Group + d = src_dict.copy() groups = [] _groups = d.pop("groups") diff --git a/qcs_api_client/models/list_quantum_processor_accessors_response.py b/qcs_api_client/models/list_quantum_processor_accessors_response.py index 0560f5a..bf9ca30 100644 --- a/qcs_api_client/models/list_quantum_processor_accessors_response.py +++ b/qcs_api_client/models/list_quantum_processor_accessors_response.py @@ -1,32 +1,41 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.quantum_processor_accessor import QuantumProcessorAccessor from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.quantum_processor_accessor import QuantumProcessorAccessor + + T = TypeVar("T", bound="ListQuantumProcessorAccessorsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListQuantumProcessorAccessorsResponse: """ Attributes: - accessors (List[QuantumProcessorAccessor]): Methods of accessing the relevant Quantum Processor + accessors (List['QuantumProcessorAccessor']): Methods of accessing the relevant Quantum Processor next_page_token (Union[Unset, str]): Opaque token indicating the start of the next page of results to return; do not decode """ - accessors: List[QuantumProcessorAccessor] + accessors: List["QuantumProcessorAccessor"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: accessors = [] for accessors_item_data in self.accessors: accessors_item = accessors_item_data.to_dict() - accessors.append(accessors_item) next_page_token = self.next_page_token @@ -49,6 +58,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.quantum_processor_accessor import QuantumProcessorAccessor + d = src_dict.copy() accessors = [] _accessors = d.pop("accessors") diff --git a/qcs_api_client/models/list_quantum_processors_response.py b/qcs_api_client/models/list_quantum_processors_response.py index 02825e8..3f4b1d0 100644 --- a/qcs_api_client/models/list_quantum_processors_response.py +++ b/qcs_api_client/models/list_quantum_processors_response.py @@ -1,32 +1,41 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.quantum_processor import QuantumProcessor from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + +if TYPE_CHECKING: + from ..models.quantum_processor import QuantumProcessor + + T = TypeVar("T", bound="ListQuantumProcessorsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListQuantumProcessorsResponse: """ Attributes: - quantum_processors (List[QuantumProcessor]): + quantum_processors (List['QuantumProcessor']): next_page_token (Union[Unset, str]): Opaque token indicating the start of the next page of results to return; do not decode """ - quantum_processors: List[QuantumProcessor] + quantum_processors: List["QuantumProcessor"] next_page_token: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: quantum_processors = [] for quantum_processors_item_data in self.quantum_processors: quantum_processors_item = quantum_processors_item_data.to_dict() - quantum_processors.append(quantum_processors_item) next_page_token = self.next_page_token @@ -49,6 +58,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.quantum_processor import QuantumProcessor + d = src_dict.copy() quantum_processors = [] _quantum_processors = d.pop("quantumProcessors") diff --git a/qcs_api_client/models/list_reservations_response.py b/qcs_api_client/models/list_reservations_response.py index 69b896a..a27ed15 100644 --- a/qcs_api_client/models/list_reservations_response.py +++ b/qcs_api_client/models/list_reservations_response.py @@ -1,32 +1,40 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.reservation import Reservation from ..types import UNSET from ..util.serialization import is_not_none + +if TYPE_CHECKING: + from ..models.reservation import Reservation + + T = TypeVar("T", bound="ListReservationsResponse") -@attr.s(auto_attribs=True) +@_attrs_define class ListReservationsResponse: """ Attributes: next_page_token (str): - reservations (List[Reservation]): + reservations (List['Reservation']): """ next_page_token: str - reservations: List[Reservation] - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + reservations: List["Reservation"] + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: next_page_token = self.next_page_token + reservations = [] for reservations_item_data in self.reservations: reservations_item = reservations_item_data.to_dict() - reservations.append(reservations_item) field_dict: Dict[str, Any] = {} @@ -46,6 +54,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.reservation import Reservation + d = src_dict.copy() next_page_token = d.pop("nextPageToken") diff --git a/qcs_api_client/models/list_reservations_show_deleted.py b/qcs_api_client/models/list_reservations_show_deleted.py new file mode 100644 index 0000000..bec7fac --- /dev/null +++ b/qcs_api_client/models/list_reservations_show_deleted.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class ListReservationsShowDeleted(str, Enum): + FALSE = "false" + TRUE = "true" + + def __str__(self) -> str: + return str(self.value) diff --git a/qcs_api_client/models/node.py b/qcs_api_client/models/node.py index 9a9fe5b..af0ed5e 100644 --- a/qcs_api_client/models/node.py +++ b/qcs_api_client/models/node.py @@ -1,14 +1,16 @@ -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr + +from attrs import define as _attrs_define from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="Node") -@attr.s(auto_attribs=True) +@_attrs_define class Node: """A logical node in the quantum processor's architecture. diff --git a/qcs_api_client/models/nomad_job_datacenters.py b/qcs_api_client/models/nomad_job_datacenters.py index 418e360..22ebf52 100644 --- a/qcs_api_client/models/nomad_job_datacenters.py +++ b/qcs_api_client/models/nomad_job_datacenters.py @@ -4,7 +4,6 @@ class NomadJobDatacenters(str, Enum): BERKELEY_775 = "berkeley-775" FREMONT_FAB = "fremont-fab" - OXFORD_INSTRUMENTS = "oxford-instruments" def __str__(self) -> str: return str(self.value) diff --git a/qcs_api_client/models/operation.py b/qcs_api_client/models/operation.py index 01f51ce..e652a0e 100644 --- a/qcs_api_client/models/operation.py +++ b/qcs_api_client/models/operation.py @@ -1,53 +1,59 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr -from ..models.characteristic import Characteristic -from ..models.operation_site import OperationSite -from ..models.parameter import Parameter +from attrs import define as _attrs_define + from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import List +from typing import Union + +if TYPE_CHECKING: + from ..models.parameter import Parameter + from ..models.characteristic import Characteristic + from ..models.operation_site import OperationSite + + T = TypeVar("T", bound="Operation") -@attr.s(auto_attribs=True) +@_attrs_define class Operation: """An operation, with its sites and site-independent characteristics. Attributes: - characteristics (List[Characteristic]): The list of site-independent characteristics of this operation. + characteristics (List['Characteristic']): The list of site-independent characteristics of this operation. name (str): The name of the operation. - parameters (List[Parameter]): The list of parameters. Each parameter must be uniquely named. May be empty. - sites (List[OperationSite]): The list of sites at which this operation can be applied, together with its site- + parameters (List['Parameter']): The list of parameters. Each parameter must be uniquely named. May be empty. + sites (List['OperationSite']): The list of sites at which this operation can be applied, together with its site- dependent characteristics. node_count (Union[Unset, int]): The number of nodes that this operation applies to. None if unspecified. """ - characteristics: List[Characteristic] + characteristics: List["Characteristic"] name: str - parameters: List[Parameter] - sites: List[OperationSite] + parameters: List["Parameter"] + sites: List["OperationSite"] node_count: Union[Unset, int] = UNSET def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: characteristics = [] for characteristics_item_data in self.characteristics: characteristics_item = characteristics_item_data.to_dict() - characteristics.append(characteristics_item) name = self.name + parameters = [] for parameters_item_data in self.parameters: parameters_item = parameters_item_data.to_dict() - parameters.append(parameters_item) sites = [] for sites_item_data in self.sites: sites_item = sites_item_data.to_dict() - sites.append(sites_item) node_count = self.node_count @@ -72,6 +78,10 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.parameter import Parameter + from ..models.characteristic import Characteristic + from ..models.operation_site import OperationSite + d = src_dict.copy() characteristics = [] _characteristics = d.pop("characteristics") diff --git a/qcs_api_client/models/operation_site.py b/qcs_api_client/models/operation_site.py index 5cbf5b0..d53a9f2 100644 --- a/qcs_api_client/models/operation_site.py +++ b/qcs_api_client/models/operation_site.py @@ -1,32 +1,38 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr -from ..models.characteristic import Characteristic +from attrs import define as _attrs_define + from ..types import UNSET from ..util.serialization import is_not_none + +from typing import cast, List + +if TYPE_CHECKING: + from ..models.characteristic import Characteristic + + T = TypeVar("T", bound="OperationSite") -@attr.s(auto_attribs=True) +@_attrs_define class OperationSite: """A site for an operation, with its site-dependent characteristics. Attributes: - characteristics (List[Characteristic]): The list of site-dependent characteristics of this operation. + characteristics (List['Characteristic']): The list of site-dependent characteristics of this operation. node_ids (List[int]): The list of architecture node ids for the site. The order of these node ids obey the definition of node symmetry from the enclosing operation. """ - characteristics: List[Characteristic] + characteristics: List["Characteristic"] node_ids: List[int] def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: characteristics = [] for characteristics_item_data in self.characteristics: characteristics_item = characteristics_item_data.to_dict() - characteristics.append(characteristics_item) node_ids = self.node_ids @@ -47,6 +53,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.characteristic import Characteristic + d = src_dict.copy() characteristics = [] _characteristics = d.pop("characteristics") diff --git a/qcs_api_client/models/parameter.py b/qcs_api_client/models/parameter.py index dc56722..70fc305 100644 --- a/qcs_api_client/models/parameter.py +++ b/qcs_api_client/models/parameter.py @@ -1,14 +1,16 @@ -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr + +from attrs import define as _attrs_define from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="Parameter") -@attr.s(auto_attribs=True) +@_attrs_define class Parameter: """A parameter to an operation. diff --git a/qcs_api_client/models/parameter_spec.py b/qcs_api_client/models/parameter_spec.py index 7349603..922d6a5 100644 --- a/qcs_api_client/models/parameter_spec.py +++ b/qcs_api_client/models/parameter_spec.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="ParameterSpec") -@attr.s(auto_attribs=True) +@_attrs_define class ParameterSpec: """ Attributes: @@ -16,7 +24,7 @@ class ParameterSpec: """ length: Union[Unset, int] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: length = self.length diff --git a/qcs_api_client/models/quantum_processor.py b/qcs_api_client/models/quantum_processor.py index f49ab09..5dd65f6 100644 --- a/qcs_api_client/models/quantum_processor.py +++ b/qcs_api_client/models/quantum_processor.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="QuantumProcessor") -@attr.s(auto_attribs=True) +@_attrs_define class QuantumProcessor: """ Attributes: @@ -16,7 +21,7 @@ class QuantumProcessor: """ id: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: id = self.id diff --git a/qcs_api_client/models/quantum_processor_accessor.py b/qcs_api_client/models/quantum_processor_accessor.py index 854b798..32923dd 100644 --- a/qcs_api_client/models/quantum_processor_accessor.py +++ b/qcs_api_client/models/quantum_processor_accessor.py @@ -1,15 +1,23 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.quantum_processor_accessor_type import QuantumProcessorAccessorType from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.quantum_processor_accessor_type import QuantumProcessorAccessorType +from typing import Union + + T = TypeVar("T", bound="QuantumProcessorAccessor") -@attr.s(auto_attribs=True) +@_attrs_define class QuantumProcessorAccessor: """Method of accessing an available QPU. @@ -30,14 +38,17 @@ class QuantumProcessorAccessor: url: str id: Union[Unset, str] = UNSET rank: Union[Unset, int] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: access_type = self.access_type.value live = self.live + url = self.url + id = self.id + rank = self.rank field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/remove_group_user_request.py b/qcs_api_client/models/remove_group_user_request.py index 53d3a33..aee8912 100644 --- a/qcs_api_client/models/remove_group_user_request.py +++ b/qcs_api_client/models/remove_group_user_request.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="RemoveGroupUserRequest") -@attr.s(auto_attribs=True) +@_attrs_define class RemoveGroupUserRequest: """Must provide either `userId` or `userEmail` and `groupId` or `groupName`. @@ -23,12 +31,15 @@ class RemoveGroupUserRequest: group_name: Union[Unset, str] = UNSET user_email: Union[Unset, str] = UNSET user_id: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: group_id = self.group_id + group_name = self.group_name + user_email = self.user_email + user_id = self.user_id field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/reservation.py b/qcs_api_client/models/reservation.py index 927caa0..40d50a6 100644 --- a/qcs_api_client/models/reservation.py +++ b/qcs_api_client/models/reservation.py @@ -1,18 +1,26 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 -from ..models.account_type import AccountType from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.account_type import AccountType +from dateutil.parser import isoparse +import datetime +from typing import Union + + T = TypeVar("T", bound="Reservation") -@attr.s(auto_attribs=True) +@_attrs_define class Reservation: """ Attributes: @@ -55,10 +63,11 @@ class Reservation: creation_billing_invoice_item_id: Union[Unset, str] = UNSET notes: Union[Unset, str] = UNSET updated_time: Union[Unset, datetime.datetime] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: account_id = self.account_id + account_type = self.account_type.value assert self.created_time.tzinfo is not None, "Datetime must have timezone information" @@ -68,23 +77,33 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no end_time = rfc3339(self.end_time) id = self.id + price = self.price + quantum_processor_id = self.quantum_processor_id + assert self.start_time.tzinfo is not None, "Datetime must have timezone information" start_time = rfc3339(self.start_time) user_id = self.user_id + cancellation_billing_invoice_item_id = self.cancellation_billing_invoice_item_id + cancelled = self.cancelled + created_by_account_id = self.created_by_account_id + created_by_account_type: Union[Unset, str] = UNSET if not isinstance(self.created_by_account_type, Unset): created_by_account_type = self.created_by_account_type.value creation_billing_invoice_item_id = self.creation_billing_invoice_item_id + notes = self.notes + updated_time: Union[Unset, str] = UNSET if not isinstance(self.updated_time, Unset): + assert self.updated_time.tzinfo is not None, "Datetime must have timezone information" updated_time = rfc3339(self.updated_time) field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/restart_endpoint_request.py b/qcs_api_client/models/restart_endpoint_request.py index 9d95204..eec09d0 100644 --- a/qcs_api_client/models/restart_endpoint_request.py +++ b/qcs_api_client/models/restart_endpoint_request.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="RestartEndpointRequest") -@attr.s(auto_attribs=True) +@_attrs_define class RestartEndpointRequest: """ Attributes: @@ -16,7 +24,7 @@ class RestartEndpointRequest: """ component_name: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: component_name = self.component_name diff --git a/qcs_api_client/models/tier.py b/qcs_api_client/models/tier.py index f4c5cc2..873d356 100644 --- a/qcs_api_client/models/tier.py +++ b/qcs_api_client/models/tier.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="Tier") -@attr.s(auto_attribs=True) +@_attrs_define class Tier: """ Attributes: @@ -24,13 +32,17 @@ class Tier: flat_amount_decimal: Union[Unset, float] = UNSET unit_amount: Union[Unset, int] = UNSET unit_amount_decimal: Union[Unset, float] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: up_to = self.up_to + flat_amount = self.flat_amount + flat_amount_decimal = self.flat_amount_decimal + unit_amount = self.unit_amount + unit_amount_decimal = self.unit_amount_decimal field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_request.py b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_request.py index b980ca7..d08cb55 100644 --- a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_request.py +++ b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_request.py @@ -1,14 +1,22 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import Union + + T = TypeVar("T", bound="TranslateNativeQuilToEncryptedBinaryRequest") -@attr.s(auto_attribs=True) +@_attrs_define class TranslateNativeQuilToEncryptedBinaryRequest: """ Attributes: @@ -21,11 +29,13 @@ class TranslateNativeQuilToEncryptedBinaryRequest: num_shots: int quil: str settings_timestamp: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: num_shots = self.num_shots + quil = self.quil + settings_timestamp = self.settings_timestamp field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response.py b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response.py index 3592395..e0d4944 100644 --- a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response.py +++ b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response.py @@ -1,17 +1,28 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.translate_native_quil_to_encrypted_binary_response_memory_descriptors import ( - TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors, -) from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from typing import cast +from typing import Union + +if TYPE_CHECKING: + from ..models.translate_native_quil_to_encrypted_binary_response_memory_descriptors import ( + TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors, + ) + + T = TypeVar("T", bound="TranslateNativeQuilToEncryptedBinaryResponse") -@attr.s(auto_attribs=True) +@_attrs_define class TranslateNativeQuilToEncryptedBinaryResponse: """ Attributes: @@ -24,13 +35,14 @@ class TranslateNativeQuilToEncryptedBinaryResponse: """ program: str - memory_descriptors: Union[Unset, TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors] = UNSET + memory_descriptors: Union[Unset, "TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors"] = UNSET ro_sources: Union[Unset, List[List[str]]] = UNSET settings_timestamp: Union[Unset, str] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: program = self.program + memory_descriptors: Union[Unset, Dict[str, Any]] = UNSET if not isinstance(self.memory_descriptors, Unset): memory_descriptors = self.memory_descriptors.to_dict() @@ -67,6 +79,10 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.translate_native_quil_to_encrypted_binary_response_memory_descriptors import ( + TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors, + ) + d = src_dict.copy() program = d.pop("program") diff --git a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response_memory_descriptors.py b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response_memory_descriptors.py index 09b6855..8220c02 100644 --- a/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response_memory_descriptors.py +++ b/qcs_api_client/models/translate_native_quil_to_encrypted_binary_response_memory_descriptors.py @@ -1,28 +1,33 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.parameter_spec import ParameterSpec from ..types import UNSET from ..util.serialization import is_not_none + +if TYPE_CHECKING: + from ..models.parameter_spec import ParameterSpec + + T = TypeVar("T", bound="TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors") -@attr.s(auto_attribs=True) +@_attrs_define class TranslateNativeQuilToEncryptedBinaryResponseMemoryDescriptors: """ """ - additional_properties: Dict[str, ParameterSpec] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, "ParameterSpec"] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: - field_dict: Dict[str, Any] = {} for prop_name, prop in self.additional_properties.items(): field_dict[prop_name] = prop.to_dict() - field_dict.update({}) - field_dict = {k: v for k, v in field_dict.items() if v != UNSET} if pick_by_predicate is not None: field_dict = {k: v for k, v in field_dict.items() if pick_by_predicate(v)} @@ -31,6 +36,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.parameter_spec import ParameterSpec + d = src_dict.copy() translate_native_quil_to_encrypted_binary_response_memory_descriptors = cls() @@ -49,10 +56,10 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: def additional_keys(self) -> List[str]: return list(self.additional_properties.keys()) - def __getitem__(self, key: str) -> ParameterSpec: + def __getitem__(self, key: str) -> "ParameterSpec": return self.additional_properties[key] - def __setitem__(self, key: str, value: ParameterSpec) -> None: + def __setitem__(self, key: str, value: "ParameterSpec") -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: diff --git a/qcs_api_client/models/user.py b/qcs_api_client/models/user.py index 1eb502f..f51aa60 100644 --- a/qcs_api_client/models/user.py +++ b/qcs_api_client/models/user.py @@ -1,18 +1,28 @@ -import datetime -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr -from dateutil.parser import isoparse +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from rfc3339 import rfc3339 -from ..models.user_profile import UserProfile from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from dateutil.parser import isoparse +import datetime +from typing import Union + +if TYPE_CHECKING: + from ..models.user_profile import UserProfile + + T = TypeVar("T", bound="User") -@attr.s(auto_attribs=True) +@_attrs_define class User: """ Attributes: @@ -25,15 +35,17 @@ class User: created_time: datetime.datetime id: int idp_id: str - profile: Union[Unset, UserProfile] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + profile: Union[Unset, "UserProfile"] = UNSET + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: assert self.created_time.tzinfo is not None, "Datetime must have timezone information" created_time = rfc3339(self.created_time) id = self.id + idp_id = self.idp_id + profile: Union[Unset, Dict[str, Any]] = UNSET if not isinstance(self.profile, Unset): profile = self.profile.to_dict() @@ -58,6 +70,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.user_profile import UserProfile + d = src_dict.copy() created_time = isoparse(d.pop("createdTime")) diff --git a/qcs_api_client/models/user_credentials.py b/qcs_api_client/models/user_credentials.py index 05ed432..eb3543c 100644 --- a/qcs_api_client/models/user_credentials.py +++ b/qcs_api_client/models/user_credentials.py @@ -1,23 +1,31 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional, TYPE_CHECKING -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.user_credentials_password import UserCredentialsPassword from ..types import UNSET from ..util.serialization import is_not_none + +if TYPE_CHECKING: + from ..models.user_credentials_password import UserCredentialsPassword + + T = TypeVar("T", bound="UserCredentials") -@attr.s(auto_attribs=True) +@_attrs_define class UserCredentials: """ Attributes: password (UserCredentialsPassword): """ - password: UserCredentialsPassword - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + password: "UserCredentialsPassword" + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: password = self.password.to_dict() @@ -38,6 +46,8 @@ def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_no @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.user_credentials_password import UserCredentialsPassword + d = src_dict.copy() password = UserCredentialsPassword.from_dict(d.pop("password")) diff --git a/qcs_api_client/models/user_credentials_password.py b/qcs_api_client/models/user_credentials_password.py index 9cfe0c1..1f5dedf 100644 --- a/qcs_api_client/models/user_credentials_password.py +++ b/qcs_api_client/models/user_credentials_password.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="UserCredentialsPassword") -@attr.s(auto_attribs=True) +@_attrs_define class UserCredentialsPassword: """ Attributes: @@ -16,7 +21,7 @@ class UserCredentialsPassword: """ value: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: value = self.value diff --git a/qcs_api_client/models/user_profile.py b/qcs_api_client/models/user_profile.py index 07cdc5d..7856382 100644 --- a/qcs_api_client/models/user_profile.py +++ b/qcs_api_client/models/user_profile.py @@ -1,14 +1,19 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field from ..types import UNSET from ..util.serialization import is_not_none + T = TypeVar("T", bound="UserProfile") -@attr.s(auto_attribs=True) +@_attrs_define class UserProfile: """ Attributes: @@ -22,12 +27,15 @@ class UserProfile: first_name: str last_name: str organization: str - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: email = self.email + first_name = self.first_name + last_name = self.last_name + organization = self.organization field_dict: Dict[str, Any] = {} diff --git a/qcs_api_client/models/validation_error.py b/qcs_api_client/models/validation_error.py index 00acedc..f1f4c0d 100644 --- a/qcs_api_client/models/validation_error.py +++ b/qcs_api_client/models/validation_error.py @@ -1,15 +1,24 @@ -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Type, TypeVar, Optional -import attr +from typing import List + + +from attrs import define as _attrs_define +from attrs import field as _attrs_field -from ..models.validation_error_in import ValidationErrorIn from ..types import UNSET, Unset from ..util.serialization import is_not_none + +from ..models.validation_error_in import ValidationErrorIn +from typing import cast +from typing import Union + + T = TypeVar("T", bound="ValidationError") -@attr.s(auto_attribs=True) +@_attrs_define class ValidationError: """ Attributes: @@ -21,12 +30,13 @@ class ValidationError: in_: ValidationErrorIn message: str path: Union[Unset, List[str]] = UNSET - additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) + additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self, pick_by_predicate: Optional[Callable[[Any], bool]] = is_not_none) -> Dict[str, Any]: in_ = self.in_.value message = self.message + path: Union[Unset, List[str]] = UNSET if not isinstance(self.path, Unset): path = self.path diff --git a/qcs_api_client/models/validation_error_in.py b/qcs_api_client/models/validation_error_in.py index 0cbfa4e..ce768ba 100644 --- a/qcs_api_client/models/validation_error_in.py +++ b/qcs_api_client/models/validation_error_in.py @@ -2,10 +2,10 @@ class ValidationErrorIn(str, Enum): + BODY = "body" HEADER = "header" - QUERY = "query" PATH = "path" - BODY = "body" + QUERY = "query" def __str__(self) -> str: return str(self.value) diff --git a/qcs_api_client/types.py b/qcs_api_client/types.py index 48968a6..0ff6145 100644 --- a/qcs_api_client/types.py +++ b/qcs_api_client/types.py @@ -1,4 +1,5 @@ """ Contains some shared types for properties """ + from typing import BinaryIO, Callable, Generic, Optional, TextIO, Tuple, TypeVar, Union import attr diff --git a/tests/test_client/test_client.py b/tests/test_client/test_client.py index 6f5494f..38946b4 100644 --- a/tests/test_client/test_client.py +++ b/tests/test_client/test_client.py @@ -127,8 +127,8 @@ def test_env_overrides(monkeypatch): assert client_configuration.secrets.file_path == Path("secrets-path.file") assert client_configuration.settings.file_path == Path("settings-path.file") - assert client_configuration.profile.api_url == "http://api.mock" - assert client_configuration.profile.grpc_api_url == "http://grpc.mock" + assert str(client_configuration.profile.api_url) == "http://api.mock/" + assert str(client_configuration.profile.grpc_api_url) == "http://grpc.mock/" assert client_configuration.profile.applications.cli.verbosity == "fatal" diff --git a/tests/test_client/test_client_configuration/test_client_configuration_file.py b/tests/test_client/test_client_configuration/test_client_configuration_file.py index 7656eaf..66bb40a 100644 --- a/tests/test_client/test_client_configuration/test_client_configuration_file.py +++ b/tests/test_client/test_client_configuration/test_client_configuration_file.py @@ -1,7 +1,7 @@ from pathlib import Path import toml -from pydantic.main import BaseConfig +from pydantic_settings import SettingsConfigDict from qcs_api_client.client._configuration.file import QCSClientConfigurationFile @@ -20,8 +20,7 @@ class PrecedenceFile(QCSClientConfigurationFile): from_file: str = "wrong" from_default: str = "in_default" - class Config(BaseConfig): - env_prefix = "TEST_CLIENT_CONFIGURATION_" + model_config = SettingsConfigDict(env_prefix="TEST_CLIENT_CONFIGURATION_") monkeypatch.setenv("TEST_CLIENT_CONFIGURATION_FROM_KWARG", "wrong") monkeypatch.setenv("TEST_CLIENT_CONFIGURATION_FROM_ENV", "in_env") diff --git a/tests/test_imports.py b/tests/test_imports.py index 128949c..65ec96f 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -1,6 +1,7 @@ """ Test that all modules in the package can be successfully imported from. """ + from importlib import import_module from pathlib import Path